Skip to content

Commit f65fb0f

Browse files
authored
chore(ci): Replace GH_CQ_BOT PAT with GitHub App tokens (#2464)
Replace GH_CQ_BOT PAT with short-lived tokens from the cloudquery-ci GitHub App.
1 parent 2623f3c commit f65fb0f

4 files changed

Lines changed: 30 additions & 8 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/gen_coverage_report.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@ jobs:
1818
id-token: write
1919
contents: write
2020
steps:
21+
- name: Generate GitHub App token
22+
id: app-token
23+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
24+
with:
25+
app-id: ${{ secrets.CQ_APP_ID }}
26+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
27+
permission-contents: write
28+
permission-pull-requests: write
2129
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2230
with:
23-
token: ${{ secrets.GH_CQ_BOT }}
31+
token: ${{ steps.app-token.outputs.token }}
2432
- name: Set up Go 1.x
2533
id: setup-go
2634
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6
@@ -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: chore/update_coverage_report
4957
base: main
5058
title: "chore: Update coverage report"
5159
commit-message: "chore: Update coverage report"
5260
body: This PR was created by a scheduled workflow to update the coverage report
53-
author: cq-bot <cq-bot@users.noreply.github.com>
5461
labels: automerge

.github/workflows/go_mod_tidy_examples.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ jobs:
1212
go-mod-tidy-example:
1313
timeout-minutes: 5
1414
runs-on: ubuntu-latest
15-
if: github.event.pull_request.user.login == 'cq-bot' && startsWith(github.event.pull_request.title, 'fix(deps)') && startsWith(github.head_ref, 'renovate/')
15+
if: github.event.pull_request.user.login == 'cloudquery-ci[bot]' && startsWith(github.event.pull_request.title, 'fix(deps)') && startsWith(github.head_ref, 'renovate/')
1616
strategy:
1717
matrix:
1818
plugin: [simple_plugin]
1919
steps:
20+
- name: Generate GitHub App token
21+
id: app-token
22+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3
23+
with:
24+
app-id: ${{ secrets.CQ_APP_ID }}
25+
private-key: ${{ secrets.CQ_APP_PRIVATE_KEY }}
26+
permission-contents: write
2027
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
2128
with:
22-
token: ${{ secrets.GH_CQ_BOT }}
29+
token: ${{ steps.app-token.outputs.token }}
2330
- name: Set up Go 1.x
2431
id: setup-go
2532
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6

.github/workflows/release-pr.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,18 @@ jobs:
1212
runs-on: ubuntu-latest
1313
timeout-minutes: 10
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: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
1624
id: release
1725
with:
18-
token: ${{ secrets.GH_CQ_BOT }}
26+
token: ${{ steps.app-token.outputs.token }}
1927
- name: Parse semver string
2028
if: steps.release.outputs.release_created
2129
id: semver_parser
@@ -34,7 +42,7 @@ jobs:
3442
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
3543
if: steps.release.outputs.release_created && steps.semver_parser.outputs.prerelease == ''
3644
with:
37-
github-token: ${{ secrets.GH_CQ_BOT }}
45+
github-token: ${{ steps.app-token.outputs.token }}
3846
script: |
3947
github.rest.actions.createWorkflowDispatch({
4048
owner: 'cloudquery',

0 commit comments

Comments
 (0)