Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct token passthrough #44

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,38 @@ runs:
with:
path: ${{ inputs.diff-storage }}
fetch-depth: 0
token: ${{ inputs.token }}

- name: Get token identity
id: identity
uses: octokit/[email protected]
with:
query: |
query {
viewer {
databaseId
login
}
}
env:
GITHUB_TOKEN: ${{ inputs.token }}

- name: Configure git
run: |
name="${{ fromJSON(steps.identity.outputs.data).viewer.login }}"
email="${{ format('{0}+{1}@users.noreply.github.com', fromJSON(steps.identity.outputs.data).viewer.databaseId, fromJSON(steps.identity.outputs.data).viewer.login) }}"

cat >> "$GITHUB_ENV" << EOF
GIT_AUTHOR_NAME=$name
GIT_AUTHOR_EMAIL=$email
GIT_COMMITTER_NAME=$name
GIT_COMMITTER_EMAIL=$email
EOF
shell: bash

- name: Initialize storage branch
working-directory: ${{ inputs.diff-storage }}
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Switch to the branch if it already exists
git switch ${{ inputs.diff-storage }} || true
git pull origin ${{ inputs.diff-storage }} || true
Expand Down Expand Up @@ -204,8 +230,6 @@ runs:
- name: Commit badge
working-directory: ${{ inputs.diff-storage }}/data
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git switch ${{ inputs.diff-storage }} || true
git pull origin ${{ inputs.diff-storage }}
git add "${{ env.diff_storage_branch }}/${{ inputs.storage-subdirectory }}/badge.svg"
Expand Down Expand Up @@ -295,6 +319,7 @@ runs:
if: contains(inputs.publish, 'true')
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ inputs.token }}
header: ${{ inputs.path }}
path: .coverage-output.final

Expand All @@ -312,8 +337,6 @@ runs:
contains(inputs.diff, 'true')
working-directory: ${{ inputs.diff-storage }}
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git switch ${{ inputs.diff-storage }}
git pull origin ${{ inputs.diff-storage }}
filename=$(basename ${{ inputs.path }})
Expand Down
Loading