Skip to content

Use workflow-pr-fixer app for Token Auth on fixup commits #1348

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
Jun 18, 2025
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions .github/actions/gradle-task-with-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ inputs:
commit-message:
description: 'The commit message to use if changes are generated'
default: ''
access-token:
description: 'The access token to use for checkouts.'
restore-cache-key:
description: 'The unique identifier for the associated cache. Any other consumers or producers for this cache must use the same name.'
default: 'null'
Expand All @@ -40,12 +42,14 @@ runs:
fi

# ensure that we have the actual branch checked out. By default, actions/checkout is headless.
- name: check out with PAT
- name: check out with the generated app token
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
if: steps.can-push.outputs.can_push == 'true'
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ inputs.access-token }}
persist-credentials: false

- name: Run ${{ inputs.fix-task }}
if: steps.can-push.outputs.can_push == 'true'
Expand All @@ -70,7 +74,7 @@ runs:

- name: commit ${{ inputs.fix-task }} changes
if: steps.can-push.outputs.can_push == 'true'
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5
uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: ${{ steps.set-commit-message.outputs.commit-message }}
commit_options: '--no-verify --signoff'
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/kotlin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ jobs :
steps :
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
# to be triggered again.
- name: Generate App Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name : check published artifacts
uses : ./.github/actions/gradle-task-with-commit
with :
check-task : connectedCheckShardMatrixYamlCheck checkVersionIsSnapshot
fix-task : connectedCheckShardMatrixYamlUpdate checkVersionIsSnapshot
write-cache-key : build-logic
access-token : ${{ steps.app-token.outputs.token }}

artifacts-check :
name : ArtifactsCheck
Expand All @@ -62,20 +71,37 @@ jobs :
steps :
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
# to be triggered again.
- name: Generate App Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name : check published artifacts
uses : ./.github/actions/gradle-task-with-commit
with :
check-task : artifactsCheck
fix-task : artifactsDump
write-cache-key : build-logic
access-token : ${{ steps.app-token.outputs.token }}

dependency-guard :
name : Dependency Guard
runs-on : ubuntu-latest
steps :
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
# to be triggered again.
- name: Generate App Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

# If the PR was made by a maintainer or Renovate, automatically update baselines and push
# so that no one has to check out the branch and update the baselines manually.
Expand All @@ -85,13 +111,22 @@ jobs :
check-task : dependencyGuard --refresh-dependencies
fix-task : dependencyGuardBaseline --refresh-dependencies
write-cache-key : build-logic
access-token : ${{ steps.app-token.outputs.token }}

ktlint :
name : KtLint
runs-on : ubuntu-latest
steps :
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
# to be triggered again.
- name: Generate App Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

# If the PR was made by a maintainer or Renovate, automatically format and push
# so that no one has to check out the branch and do it manually.
Expand All @@ -101,13 +136,22 @@ jobs :
check-task : ktLintCheck
fix-task : ktLintFormat
write-cache-key : build-logic
access-token : ${{ steps.app-token.outputs.token }}

api-check :
name : Api check
runs-on : ubuntu-latest
steps :
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
# to be triggered again.
- name: Generate App Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

# If the PR was made by a maintainer or Renovate, automatically format and push
# so that no one has to check out the branch and do it manually.
Expand All @@ -117,6 +161,7 @@ jobs :
check-task : apiCheck
fix-task : apiDump
write-cache-key : build-logic
access-token : ${{ steps.app-token.outputs.token }}

android-lint :
name : Android Lint
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:

jobs:
publish-release:
# macos-latest is too slow. -14 will become latest in Q2 '24
runs-on: macos-14
runs-on: macos-latest
if: github.repository == 'square/workflow-kotlin'
timeout-minutes: 45

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ on:

jobs:
publish-snapshot:
# macos-latest is too slow. -14 will become latest in Q2 '24
runs-on: macos-14
runs-on: macos-latest
if: github.repository == 'square/workflow-kotlin'
timeout-minutes: 45

Expand Down
Loading