Skip to content

Commit 4fd9558

Browse files
authored
chore(ci): Replace GH_CQ_BOT PAT with GitHub App tokens (#627)
Replace GH_CQ_BOT PAT with short-lived tokens from the cloudquery-ci GitHub App.
1 parent 07f68e6 commit 4fd9558

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

.github/.kodiak.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version = 1
33

44
[approve]
5-
auto_approve_usernames = ["cq-bot"]
5+
auto_approve_usernames = ["cloudquery-ci"]
66

77
[merge.message]
88
body = "pull_request_body"

.github/workflows/regen.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ jobs:
1212
timeout-minutes: 30
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Generate GitHub App token
16+
id: app-token
17+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
18+
with:
19+
app-id: ${{ secrets.CQ_APP_ID }}
20+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
21+
permission-contents: write
22+
permission-pull-requests: write
1523
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
1624
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
1725
id: go
@@ -44,11 +52,10 @@ jobs:
4452
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8
4553
with:
4654
# required so the PR triggers workflow runs
47-
token: ${{ secrets.GH_CQ_BOT }}
55+
token: ${{ steps.app-token.outputs.token }}
4856
branch: fix/gen_proto
4957
base: main
5058
title: "fix: Generate Go Code from `plugin-pb`"
5159
commit-message: "fix: Generate Go Code from `plugin-pb`"
5260
body: This PR was created by a scheduled workflow to regenerate the Go code from `plugin-pb`.
53-
author: cq-bot <cq-bot@users.noreply.github.com>
5461
labels: automerge

.github/workflows/release_pr.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ jobs:
1111
release-please:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Generate GitHub App token
15+
id: app-token
16+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
17+
with:
18+
app-id: ${{ secrets.CQ_APP_ID }}
19+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
20+
permission-contents: write
21+
permission-pull-requests: write
1422
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
1523
id: release
1624
with:
17-
token: ${{ secrets.GH_CQ_BOT }}
25+
token: ${{ steps.app-token.outputs.token }}
1826
- name: Parse semver string
1927
if: steps.release.outputs.release_created
2028
id: semver_parser
@@ -33,7 +41,7 @@ jobs:
3341
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
3442
if: steps.release.outputs.release_created && steps.semver_parser.outputs.prerelease == ''
3543
with:
36-
github-token: ${{ secrets.GH_CQ_BOT }}
44+
github-token: ${{ steps.app-token.outputs.token }}
3745
script: |
3846
github.rest.actions.createWorkflowDispatch({
3947
owner: 'cloudquery',

0 commit comments

Comments
 (0)