Skip to content

Commit 53b4b8e

Browse files
ci: migrate GH_TOKEN_ADMIN to GitHub App token (#156)
## Summary - Replace `GH_TOKEN_ADMIN` (long-lived PAT) with short-lived GitHub App installation tokens via `actions/create-github-app-token@v3`. - Each job that needed the token (`build_action`, `update-semver`) gets its own token-generation step, since app tokens are revoked at job end. - Uses the centrally-synced `GH_APP_CLIENT_ID` / `GH_APP_PRIVATE_KEY` secrets managed by `splunk/addonfactory-sync-secrets`. Made with [Cursor](https://cursor.com)
2 parents 0ecade9 + 882a716 commit 53b4b8e

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ jobs:
4848
with:
4949
submodules: recursive
5050
persist-credentials: false
51+
- name: Generate GitHub App Token
52+
id: app-token
53+
uses: actions/create-github-app-token@v3
54+
with:
55+
client-id: ${{ secrets.GH_APP_CLIENT_ID }}
56+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
57+
owner: ${{ github.repository_owner }}
5158
- name: Install yq
5259
run: sudo snap install yq
5360
- name: Set up QEMU
@@ -90,7 +97,7 @@ jobs:
9097
- name: Semantic Release
9198
uses: splunk/semantic-release-action@v1.3
9299
env:
93-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
100+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
94101
with:
95102
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
96103
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
@@ -105,9 +112,16 @@ jobs:
105112
runs-on: ubuntu-latest
106113
steps:
107114
- uses: actions/checkout@v4
115+
- name: Generate GitHub App Token
116+
id: app-token
117+
uses: actions/create-github-app-token@v3
118+
with:
119+
client-id: ${{ secrets.GH_APP_CLIENT_ID }}
120+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
121+
owner: ${{ github.repository_owner }}
108122
- uses: splunk/addonfactory-update-semver@v1
109123
env:
110-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
124+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
111125
with:
112126
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
113127
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}

0 commit comments

Comments
 (0)