Skip to content

Commit fd13bbc

Browse files
stevesCopilot
andauthored
Move app-token generation behind failure condition in workflows (#61891)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 90cf640 commit fd13bbc

4 files changed

Lines changed: 40 additions & 36 deletions

File tree

.github/workflows/keep-caches-warm.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ jobs:
3030
steps:
3131
- name: Check out repo
3232
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
33-
- name: Generate GitHub App token
34-
id: app-token
35-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
36-
with:
37-
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
38-
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
39-
owner: github
40-
repositories: docs-engineering
41-
4233
- uses: ./.github/actions/node-npm-setup
4334

4435
- uses: ./.github/actions/cache-nextjs
@@ -57,6 +48,16 @@ jobs:
5748
with:
5849
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
5950

51+
- name: Generate GitHub App token
52+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
53+
id: app-token
54+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
55+
with:
56+
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
57+
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
58+
owner: github
59+
repositories: docs-engineering
60+
6061
- uses: ./.github/actions/create-workflow-failure-issue
6162
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
6263
with:

.github/workflows/moda-allowed-ips.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ jobs:
2020
steps:
2121
- name: Check out the repository
2222
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
23-
- name: Generate GitHub App token
24-
id: app-token
25-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
26-
with:
27-
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
28-
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
29-
owner: github
30-
repositories: docs-engineering
31-
3223
- name: Update list of allowed IPs
3324
run: |
3425
echo "Getting a list of Fastly IP addresses...."
@@ -68,6 +59,16 @@ jobs:
6859
with:
6960
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
7061

62+
- name: Generate GitHub App token
63+
if: ${{ failure() }}
64+
id: app-token
65+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
66+
with:
67+
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
68+
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
69+
owner: github
70+
repositories: docs-engineering
71+
7172
- uses: ./.github/actions/create-workflow-failure-issue
7273
if: ${{ failure() }}
7374
with:

.github/workflows/repo-sync.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ jobs:
2626
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2727
with:
2828
persist-credentials: false
29-
- name: Generate GitHub App token
30-
id: app-token
31-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
32-
with:
33-
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
34-
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
35-
owner: github
36-
repositories: docs-engineering
37-
3829
- name: Sync repo to branch
3930
env:
4031
SOURCE_REPO: https://${{ secrets.DOCS_BOT_PAT_REPO_SYNC }}@github.com/github/${{ github.repository == 'github/docs-internal' && 'docs' || 'docs-internal' }}.git
@@ -201,6 +192,16 @@ jobs:
201192
with:
202193
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
203194

195+
- name: Generate GitHub App token
196+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
197+
id: app-token
198+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
199+
with:
200+
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
201+
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
202+
owner: github
203+
repositories: docs-engineering
204+
204205
- uses: ./.github/actions/create-workflow-failure-issue
205206
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
206207
with:

.github/workflows/stale.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@ jobs:
2121
if: github.repository == 'github/docs-internal'
2222
runs-on: ubuntu-latest
2323
steps:
24-
- name: Generate GitHub App token
25-
id: app-token
26-
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
27-
with:
28-
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
29-
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
30-
owner: github
31-
repositories: docs-engineering
32-
3324
- uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f # v10.0.0
3425
with:
3526
repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -53,6 +44,16 @@ jobs:
5344
with:
5445
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
5546

47+
- name: Generate GitHub App token
48+
if: ${{ failure() }}
49+
id: app-token
50+
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
51+
with:
52+
app-id: ${{ secrets.DOCS_BOT_APP_ID }}
53+
private-key: ${{ secrets.DOCS_BOT_APP_PRIVATE_KEY }}
54+
owner: github
55+
repositories: docs-engineering
56+
5657
- uses: ./.github/actions/create-workflow-failure-issue
5758
if: ${{ failure() }}
5859
with:

0 commit comments

Comments
 (0)