Skip to content

Simplify auto spotless workflow #1919

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

Merged
merged 1 commit into from
May 29, 2025
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
40 changes: 17 additions & 23 deletions .github/workflows/auto-spotless-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
Loading