Skip to content

Commit 793a3ab

Browse files
authored
Fix spotless automation (#1922)
1 parent f4ff5f4 commit 793a3ab

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/auto-spotless-apply.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,30 @@ jobs:
6565
if: steps.unzip-patch.outputs.exists == 'true'
6666
name: Get PR
6767
env:
68+
GH_REPO: ${{ github.repository }}
69+
GH_TOKEN: ${{ github.token }}
6870
PR_BRANCH: |-
6971
${{
7072
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
7173
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
7274
|| github.event.workflow_run.head_branch
7375
}}
74-
GH_TOKEN: ${{ github.token }}
7576
run: |
76-
number=$(gh pr view --repo "${{ github.event.workflow_run.repository.full_name }}" "${PR_BRANCH}" --json number --jq .number)
77+
number=$(gh pr view "$PR_BRANCH" --json number --jq .number)
7778
echo "number=$number" >> $GITHUB_OUTPUT
7879
7980
- if: steps.unzip-patch.outputs.exists == 'true' && success()
8081
env:
82+
GH_REPO: ${{ github.repository }}
8183
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
84+
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
8285
run: |
83-
gh pr comment ${{ steps.get-pr.outputs.number }} --body "🔧 The result from spotlessApply was committed to the PR branch."
86+
gh pr comment $PR_NUMBER --body "🔧 The result from spotlessApply was committed to the PR branch."
8487
8588
- if: steps.unzip-patch.outputs.exists == 'true' && failure()
8689
env:
90+
GH_REPO: ${{ github.repository }}
8791
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
92+
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
8893
run: |
89-
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."
94+
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

Comments
 (0)