3636
3737 - name : Check out PR branch
3838 uses : actions/checkout@v3
39- env :
39+ env :
4040 HEADREPOFULLNAME : ${{ steps.pr_info.outputs.headRepoFullName }}
4141 HEADREF : ${{ steps.pr_info.outputs.headRef }}
4242 with :
@@ -48,10 +48,14 @@ jobs:
4848 token : ${{ secrets.GITHUB_TOKEN }}
4949
5050 - name : Debug
51+ env :
52+ HEADREPOFULLNAME : ${{ steps.pr_info.outputs.headRepoFullName }}
53+ HEADREF : ${{ steps.pr_info.outputs.headRef }}
54+ PRNUMBER : ${{ steps.pr_info.outputs.prNumber }}
5155 run : |
52- echo "PR Number : ${{ steps.pr_info.outputs.prNumber }} "
53- echo "Head Ref: ${{ steps.pr_info.outputs.headRef }} "
54- echo "Head Repo Full Name: ${{ steps.pr_info.outputs.headRepoFullName }} "
56+ echo "PR number : $PRNUMBER "
57+ echo "Head Ref: $HEADREF "
58+ echo "Head Repo Full Name: $HEADREPOFULLNAME "
5559
5660 - name : Set up Python
5761 uses : actions/setup-python@v4
@@ -67,27 +71,30 @@ jobs:
6771
6872 - name : Commit and push changes
6973 id : commit_and_push
74+ env :
75+ HEADREPOFULLNAME : ${{ steps.pr_info.outputs.headRepoFullName }}
76+ HEADREF : ${{ steps.pr_info.outputs.headRef }}
77+ PRNUMBER : ${{ steps.pr_info.outputs.prNumber }}
78+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7079 run : |
7180 # Configure git with the Actions bot user
7281 git config user.name "github-actions[bot]"
7382 git config user.email "github-actions[bot]@users.noreply.github.com"
7483
7584 # Make sure your 'origin' remote is set to the contributor's fork
76- git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ steps.pr_info.outputs.headRepoFullName }}.git"
85+ git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ steps.commit_and_push.env.HEADREPOFULLNAME }}.git"
7786
7887 # If there are changes after running style/quality, commit them
7988 if [ -n "$(git status --porcelain)" ]; then
8089 git add .
8190 git commit -m "Apply style fixes"
8291 # Push to the original contributor's forked branch
83- git push origin HEAD:${{ steps.pr_info.outputs.headRef }}
92+ git push origin HEAD:${{ steps.commit_and_push.env.HEADREF }}
8493 echo "changes_pushed=true" >> $GITHUB_OUTPUT
8594 else
8695 echo "No changes to commit."
8796 echo "changes_pushed=false" >> $GITHUB_OUTPUT
8897 fi
89- env :
90- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
9198
9299 - name : Comment on PR with workflow run link
93100 if : steps.commit_and_push.outputs.changes_pushed == 'true'
0 commit comments