@@ -43,31 +43,10 @@ jobs:
4343      - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683  #  v4.2.2
4444        if : steps.unzip-patch.outputs.exists == 'true' 
4545        with :
46+           repository : " ${{ github.event.workflow_run.head_repository.full_name }}" 
47+           ref : " ${{ github.event.workflow_run.head_branch }}" 
4648          token : ${{ steps.otelbot-token.outputs.token }} 
4749
48-       - id : get-pr 
49-         if : steps.unzip-patch.outputs.exists == 'true' 
50-         name : Get PR 
51-         env :
52-           PR_BRANCH : |- 
53-             ${{ 
54-               (github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login) 
55-                 && format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) 
56-                 || github.event.workflow_run.head_branch 
57-             }} 
58-            GH_TOKEN : ${{ github.token }} 
59-         run : | 
60-           echo gh pr view "${PR_BRANCH}" --json number --jq .number 
61-           number=$(gh pr view "${PR_BRANCH}" --json number --jq .number) 
62-           echo $number 
63-           echo "number=$number" >> $GITHUB_OUTPUT 
64- 
65-        - name : Check out PR branch 
66-         if : steps.unzip-patch.outputs.exists == 'true' 
67-         env :
68-           GH_TOKEN : ${{ github.token }} 
69-         run : gh pr checkout ${{ steps.get-pr.outputs.number }} 
70- 
7150      - name : Use CLA approved github bot 
7251        if : steps.unzip-patch.outputs.exists == 'true' 
7352        #  IMPORTANT do not call the .github/scripts/use-cla-approved-bot.sh
@@ -83,14 +62,34 @@ jobs:
8362          git commit -a -m "./gradlew spotlessApply" 
8463          git push 
8564
65+        - id : get-pr 
66+         if : steps.unzip-patch.outputs.exists == 'true' 
67+         name : Get PR 
68+         env :
69+           GH_REPO : ${{ github.repository }} 
70+           GH_TOKEN : ${{ github.token }} 
71+           PR_BRANCH : |- 
72+             ${{ 
73+               (github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login) 
74+                 && format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) 
75+                 || github.event.workflow_run.head_branch 
76+             }} 
77+          run : | 
78+           number=$(gh pr view "$PR_BRANCH" --json number --jq .number) 
79+           echo "number=$number" >> $GITHUB_OUTPUT 
80+ 
8681       - if : steps.unzip-patch.outputs.exists == 'true' && success() 
8782        env :
83+           GH_REPO : ${{ github.repository }} 
8884          GH_TOKEN : ${{ steps.otelbot-token.outputs.token }} 
85+           PR_NUMBER : ${{ steps.get-pr.outputs.number }} 
8986        run : | 
90-           gh pr comment ${{ steps.get-pr.outputs.number }}  --body "🔧 The result from spotlessApply was committed to the PR branch." 
87+           gh pr comment $PR_NUMBER  --body "🔧 The result from spotlessApply was committed to the PR branch." 
9188
9289       - if : steps.unzip-patch.outputs.exists == 'true' && failure() 
9390        env :
91+           GH_REPO : ${{ github.repository }} 
9492          GH_TOKEN : ${{ steps.otelbot-token.outputs.token }} 
93+           PR_NUMBER : ${{ steps.get-pr.outputs.number }} 
9594        run : | 
96-           gh pr comment ${{ steps.get-pr.outputs.number }}  --body "❌ The result from spotlessApply could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID." 
95+           gh pr comment $PR_NUMBER  --body "❌ The result from spotlessApply could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID." 
0 commit comments