Skip to content

Commit 7ff3cfb

Browse files
authored
chore(ci): Replace GH_CQ_BOT PAT with GitHub App tokens (#54)
Replace GH_CQ_BOT PAT with short-lived tokens from the cloudquery-ci GitHub App.
1 parent 2b6225a commit 7ff3cfb

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/gen-client.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,22 @@ jobs:
77
timeout-minutes: 30
88
runs-on: ubuntu-latest
99
steps:
10+
- name: Generate GitHub App token
11+
id: app-token
12+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
13+
with:
14+
app-id: ${{ secrets.CQ_APP_ID }}
15+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
16+
permission-contents: write
17+
permission-pull-requests: write
1018
- name: Checkout
1119
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1220
with:
13-
token: ${{ secrets.GH_CQ_BOT }}
21+
token: ${{ steps.app-token.outputs.token }}
1422

1523
- name: Get Specs File
1624
run: |
17-
curl -H "Authorization: token ${{ secrets.GH_CQ_BOT }}" https://raw.githubusercontent.com/cloudquery/cloud/main/platform/internal/servergen/spec.json -o spec.json
25+
curl -H "Authorization: token ${{ steps.app-token.outputs.token }}" https://raw.githubusercontent.com/cloudquery/cloud/main/platform/internal/servergen/spec.json -o spec.json
1826
1927
- name: Set up Go 1.x
2028
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@@ -29,11 +37,10 @@ jobs:
2937
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8
3038
with:
3139
# required so the PR triggers workflow runs
32-
token: ${{ secrets.GH_CQ_BOT }}
40+
token: ${{ steps.app-token.outputs.token }}
3341
branch: fix/gen-cloudquery-api
3442
base: main
3543
title: "fix: Generate CloudQuery Go API Client from `spec.json`"
3644
commit-message: "fix: Generate CloudQuery Go API Client from `spec.json`"
3745
body: This PR was created by a scheduled workflow to generate the CloudQuery Go API Client from `spec.json`
38-
author: cq-bot <cq-bot@users.noreply.github.com>
3946
labels: automerge

.github/workflows/release-pr.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ jobs:
1010
runs-on: ubuntu-latest
1111
timeout-minutes: 10
1212
steps:
13+
- name: Generate GitHub App token
14+
id: app-token
15+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
16+
with:
17+
app-id: ${{ secrets.CQ_APP_ID }}
18+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
19+
permission-contents: write
20+
permission-pull-requests: write
1321
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
1422
id: release
1523
with:
16-
token: ${{ secrets.GH_CQ_BOT }}
24+
token: ${{ steps.app-token.outputs.token }}
1725
- name: Parse semver string
1826
if: steps.release.outputs.release_created
1927
id: semver_parser
@@ -32,7 +40,7 @@ jobs:
3240
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
3341
if: steps.release.outputs.release_created && steps.semver_parser.outputs.prerelease == ''
3442
with:
35-
github-token: ${{ secrets.GH_CQ_BOT }}
43+
github-token: ${{ steps.app-token.outputs.token }}
3644
script: |
3745
github.rest.actions.createWorkflowDispatch({
3846
owner: 'cloudquery',

0 commit comments

Comments
 (0)