diff --git a/.github/workflows/auto-spotless-apply.yml b/.github/workflows/auto-spotless-apply.yml index 6312417f7..13753e8c3 100644 --- a/.github/workflows/auto-spotless-apply.yml +++ b/.github/workflows/auto-spotless-apply.yml @@ -42,31 +42,10 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 if: steps.unzip-patch.outputs.exists == 'true' with: + repository: "${{ github.event.workflow_run.head_repository.full_name }}" + ref: "${{ github.event.workflow_run.head_branch }}" token: ${{ steps.otelbot-token.outputs.token }} - - id: get-pr - if: steps.unzip-patch.outputs.exists == 'true' - name: Get PR - env: - PR_BRANCH: |- - ${{ - (github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login) - && format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) - || github.event.workflow_run.head_branch - }} - GH_TOKEN: ${{ github.token }} - run: | - echo gh pr view "${PR_BRANCH}" --json number --jq .number - number=$(gh pr view "${PR_BRANCH}" --json number --jq .number) - echo $number - echo "number=$number" >> $GITHUB_OUTPUT - - - name: Check out PR branch - if: steps.unzip-patch.outputs.exists == 'true' - env: - GH_TOKEN: ${{ github.token }} - run: gh pr checkout ${{ steps.get-pr.outputs.number }} - - name: Use CLA approved github bot if: steps.unzip-patch.outputs.exists == 'true' # IMPORTANT do not call the .github/scripts/use-cla-approved-bot.sh @@ -82,6 +61,21 @@ jobs: git commit -a -m "./gradlew spotlessApply" git push + - id: get-pr + if: steps.unzip-patch.outputs.exists == 'true' + name: Get PR + env: + PR_BRANCH: |- + ${{ + (github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login) + && format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) + || github.event.workflow_run.head_branch + }} + GH_TOKEN: ${{ github.token }} + run: | + number=$(gh pr view --repo "${{ github.event.workflow_run.repository.full_name }}" "${PR_BRANCH}" --json number --jq .number) + echo "number=$number" >> $GITHUB_OUTPUT + - if: steps.unzip-patch.outputs.exists == 'true' && success() env: GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}