Skip to content

Commit cbcb12e

Browse files
Merge pull request #1348 from square/sedwards/disable-commit-fix
Use workflow-pr-fixer app for Token Auth on fixup commits
2 parents c789f9b + 2c5f499 commit cbcb12e

File tree

4 files changed

+53
-6
lines changed

4 files changed

+53
-6
lines changed

.github/actions/gradle-task-with-commit/action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ inputs:
1717
commit-message:
1818
description: 'The commit message to use if changes are generated'
1919
default: ''
20+
access-token:
21+
description: 'The access token to use for checkouts.'
2022
restore-cache-key:
2123
description: 'The unique identifier for the associated cache. Any other consumers or producers for this cache must use the same name.'
2224
default: 'null'
@@ -40,12 +42,14 @@ runs:
4042
fi
4143
4244
# ensure that we have the actual branch checked out. By default, actions/checkout is headless.
43-
- name: check out with PAT
45+
- name: check out with the generated app token
4446
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
4547
if: steps.can-push.outputs.can_push == 'true'
4648
with:
4749
ref: ${{ github.head_ref }}
4850
fetch-depth: 0
51+
token: ${{ inputs.access-token }}
52+
persist-credentials: false
4953

5054
- name: Run ${{ inputs.fix-task }}
5155
if: steps.can-push.outputs.can_push == 'true'
@@ -70,7 +74,7 @@ runs:
7074
7175
- name: commit ${{ inputs.fix-task }} changes
7276
if: steps.can-push.outputs.can_push == 'true'
73-
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5
77+
uses: stefanzweifel/git-auto-commit-action@v6
7478
with:
7579
commit_message: ${{ steps.set-commit-message.outputs.commit-message }}
7680
commit_options: '--no-verify --signoff'

.github/workflows/kotlin.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,22 @@ jobs :
4747
steps :
4848
- name: Checkout
4949
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
50+
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
51+
# to be triggered again.
52+
- name: Generate App Token
53+
uses: actions/create-github-app-token@v2
54+
id: app-token
55+
with:
56+
app-id: ${{ vars.APP_ID }}
57+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
5058

5159
- name : check published artifacts
5260
uses : ./.github/actions/gradle-task-with-commit
5361
with :
5462
check-task : connectedCheckShardMatrixYamlCheck checkVersionIsSnapshot
5563
fix-task : connectedCheckShardMatrixYamlUpdate checkVersionIsSnapshot
5664
write-cache-key : build-logic
65+
access-token : ${{ steps.app-token.outputs.token }}
5766

5867
artifacts-check :
5968
name : ArtifactsCheck
@@ -62,20 +71,37 @@ jobs :
6271
steps :
6372
- name: Checkout
6473
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
74+
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
75+
# to be triggered again.
76+
- name: Generate App Token
77+
uses: actions/create-github-app-token@v2
78+
id: app-token
79+
with:
80+
app-id: ${{ vars.APP_ID }}
81+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
6582

6683
- name : check published artifacts
6784
uses : ./.github/actions/gradle-task-with-commit
6885
with :
6986
check-task : artifactsCheck
7087
fix-task : artifactsDump
7188
write-cache-key : build-logic
89+
access-token : ${{ steps.app-token.outputs.token }}
7290

7391
dependency-guard :
7492
name : Dependency Guard
7593
runs-on : ubuntu-latest
7694
steps :
7795
- name: Checkout
7896
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
97+
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
98+
# to be triggered again.
99+
- name: Generate App Token
100+
uses: actions/create-github-app-token@v2
101+
id: app-token
102+
with:
103+
app-id: ${{ vars.APP_ID }}
104+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
79105

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

89116
ktlint :
90117
name : KtLint
91118
runs-on : ubuntu-latest
92119
steps :
93120
- name: Checkout
94121
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
122+
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
123+
# to be triggered again.
124+
- name: Generate App Token
125+
uses: actions/create-github-app-token@v2
126+
id: app-token
127+
with:
128+
app-id: ${{ vars.APP_ID }}
129+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
95130

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

105141
api-check :
106142
name : Api check
107143
runs-on : ubuntu-latest
108144
steps :
109145
- name: Checkout
110146
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
147+
# We use the workflow-pr-fixer app to authenticate and get a token that will cause the workflow
148+
# to be triggered again.
149+
- name: Generate App Token
150+
uses: actions/create-github-app-token@v2
151+
id: app-token
152+
with:
153+
app-id: ${{ vars.APP_ID }}
154+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
111155

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

121166
android-lint :
122167
name : Android Lint

.github/workflows/publish-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ on:
55

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

.github/workflows/publish-snapshot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ on:
88

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

0 commit comments

Comments
 (0)