Skip to content

Commit 3d6ad3a

Browse files
authored
feat: move to github app token (#97)
1 parent 7c7ce9f commit 3d6ad3a

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

.github/workflows/auto-merge-generated-prs.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ jobs:
1616
startsWith(github.event.pull_request.title, 'chore: 🐝 Update SDK - Generate')
1717
runs-on: ubuntu-latest
1818
steps:
19+
- name: Generate GitHub App Token
20+
id: app-token
21+
uses: actions/create-github-app-token@v1
22+
with:
23+
app-id: ${{ secrets.GH_CI_BOT_APP_ID }}
24+
private-key: ${{ secrets.GH_CI_BOT_APP_PRIVATE_KEY }}
25+
owner: apideck-io
26+
1927
- name: Check labels (needs minor or patch)
2028
id: labels
2129
uses: actions/github-script@v7
@@ -31,7 +39,7 @@ jobs:
3139
if: steps.labels.outputs.match == 'true'
3240
uses: actions/github-script@v7
3341
with:
34-
github-token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }}
42+
github-token: ${{ steps.app-token.outputs.token }}
3543
script: |
3644
const { owner, repo } = context.repo;
3745
const prNumber = context.payload.pull_request.number;
@@ -54,6 +62,6 @@ jobs:
5462
with:
5563
pull-request-number: ${{ github.event.pull_request.number }}
5664
merge-method: squash
57-
token: ${{ secrets.GITHUB_TOKEN }}
65+
token: ${{ steps.app-token.outputs.token }}
5866

5967

.github/workflows/sdk_generation.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,28 @@ permissions:
1818
schedule:
1919
- cron: 0 0 * * *
2020
jobs:
21+
generate-token:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
token: ${{ steps.app-token.outputs.token }}
25+
steps:
26+
- name: Generate GitHub App Token
27+
id: app-token
28+
uses: actions/create-github-app-token@v1
29+
with:
30+
app-id: ${{ secrets.GH_CI_BOT_APP_ID }}
31+
private-key: ${{ secrets.GH_CI_BOT_APP_PRIVATE_KEY }}
32+
owner: apideck-io
33+
2134
generate:
35+
needs: generate-token
2236
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
2337
with:
2438
force: ${{ github.event.inputs.force }}
2539
mode: pr
2640
set_version: ${{ github.event.inputs.set_version }}
2741
speakeasy_version: latest
2842
secrets:
29-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
43+
github_access_token: ${{ needs.generate-token.outputs.token }}
3044
npm_token: ${{ secrets.NPM_TOKEN }}
3145
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/sdk_publish.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,25 @@ permissions:
1313
- .speakeasy/gen.lock
1414
workflow_dispatch: {}
1515
jobs:
16+
generate-token:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
token: ${{ steps.app-token.outputs.token }}
20+
steps:
21+
- name: Generate GitHub App Token
22+
id: app-token
23+
uses: actions/create-github-app-token@v1
24+
with:
25+
app-id: ${{ secrets.GH_CI_BOT_APP_ID }}
26+
private-key: ${{ secrets.GH_CI_BOT_APP_PRIVATE_KEY }}
27+
owner: apideck-io
28+
1629
publish:
30+
needs: generate-token
1731
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
1832
with:
1933
target: apideck
2034
secrets:
21-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
35+
github_access_token: ${{ needs.generate-token.outputs.token }}
2236
npm_token: ${{ secrets.NPM_TOKEN }}
2337
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

.github/workflows/sdk_test.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,24 @@ permissions:
1717
description: Provided SDK target to run tests for, (all) is valid
1818
type: string
1919
jobs:
20+
generate-token:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
token: ${{ steps.app-token.outputs.token }}
24+
steps:
25+
- name: Generate GitHub App Token
26+
id: app-token
27+
uses: actions/create-github-app-token@v1
28+
with:
29+
app-id: ${{ secrets.GH_CI_BOT_APP_ID }}
30+
private-key: ${{ secrets.GH_CI_BOT_APP_PRIVATE_KEY }}
31+
owner: apideck-io
32+
2033
test:
34+
needs: generate-token
2135
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-test.yaml@v15
2236
with:
2337
target: ${{ github.event.inputs.target || 'apideck' }}
2438
secrets:
25-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
39+
github_access_token: ${{ needs.generate-token.outputs.token }}
2640
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

0 commit comments

Comments
 (0)