2525 actions : write
2626
2727 steps :
28+ - name : Generate GitHub App token
29+ id : app-token
30+ uses : actions/create-github-app-token@v1
31+ with :
32+ app-id : ${{ secrets.COZYSTACK_CI_APP_ID }}
33+ private-key : ${{ secrets.COZYSTACK_CI_PRIVATE_KEY }}
34+ owner : cozystack
35+
2836 # Check if a non-draft release with this tag already exists
2937 - name : Check if release already exists
3038 id : check_release
@@ -115,11 +123,11 @@ jobs:
115123 - name : Commit release artifacts
116124 if : steps.check_release.outputs.skip == 'false'
117125 env :
118- GH_PAT : ${{ secrets.GH_PAT }}
126+ APP_TOKEN : ${{ steps.app-token.outputs.token }}
119127 run : |
120- git config user.name "cozystack-bot"
121- git config user.email "217169706 [email protected] " 122- git remote set-url origin https://cozystack-bot :${GH_PAT }@github.com/${GITHUB_REPOSITORY}
128+ git config user.name "cozystack-ci[ bot] "
129+ git config user.email "3297617 +cozystack-ci[ bot] @users.noreply.github.com"
130+ git remote set-url origin https://x-access-token :${APP_TOKEN }@github.com/${GITHUB_REPOSITORY}
123131 git config --unset-all http.https://github.com/.extraheader || true
124132 git add .
125133 git commit -m "Prepare release ${GITHUB_REF#refs/tags/}" -s || echo "No changes to commit"
@@ -128,13 +136,13 @@ jobs:
128136 - name : Tag API submodule
129137 if : steps.check_release.outputs.skip == 'false'
130138 env :
131- GH_PAT : ${{ secrets.GH_PAT }}
139+ APP_TOKEN : ${{ steps.app-token.outputs.token }}
132140 run : |
133141 VTAG="${{ steps.tag.outputs.tag }}"
134142 SUBTAG="api/apps/v1alpha1/${VTAG}"
135- git config user.name "cozystack-bot"
136- git config user.email "217169706 [email protected] " 137- git remote set-url origin https://cozystack-bot :${GH_PAT }@github.com/${GITHUB_REPOSITORY}
143+ git config user.name "cozystack-ci[ bot] "
144+ git config user.email "3297617 +cozystack-ci[ bot] @users.noreply.github.com"
145+ git remote set-url origin https://x-access-token :${APP_TOKEN }@github.com/${GITHUB_REPOSITORY}
138146 TARGET="$(git rev-parse "${VTAG}^{}")"
139147 git tag -f "${SUBTAG}" "$TARGET"
140148 git push -f origin "refs/tags/${SUBTAG}"
@@ -183,11 +191,11 @@ jobs:
183191 - name : Create release branch
184192 if : steps.check_release.outputs.skip == 'false'
185193 env :
186- GH_PAT : ${{ secrets.GH_PAT }}
194+ APP_TOKEN : ${{ steps.app-token.outputs.token }}
187195 run : |
188- git config user.name "cozystack-bot"
189- git config user.email "217169706 [email protected] " 190- git remote set-url origin https://cozystack-bot :${GH_PAT }@github.com/${GITHUB_REPOSITORY}
196+ git config user.name "cozystack-ci[ bot] "
197+ git config user.email "3297617 +cozystack-ci[ bot] @users.noreply.github.com"
198+ git remote set-url origin https://x-access-token :${APP_TOKEN }@github.com/${GITHUB_REPOSITORY}
191199 BRANCH="release-${GITHUB_REF#refs/tags/v}"
192200 git branch -f "$BRANCH"
193201 git push -f origin "$BRANCH"
@@ -197,7 +205,7 @@ jobs:
197205 if : steps.check_release.outputs.skip == 'false'
198206 uses : actions/github-script@v7
199207 with :
200- github-token : ${{ secrets.GH_PAT }}
208+ github-token : ${{ steps.app-token.outputs.token }}
201209 script : |
202210 const version = context.ref.replace('refs/tags/v', '');
203211 const base = '${{ steps.get_base.outputs.branch }}';
@@ -239,6 +247,14 @@ jobs:
239247 pull-requests : write
240248 if : needs.prepare-release.result == 'success'
241249 steps :
250+ - name : Generate GitHub App token
251+ id : app-token
252+ uses : actions/create-github-app-token@v1
253+ with :
254+ app-id : ${{ secrets.COZYSTACK_CI_APP_ID }}
255+ private-key : ${{ secrets.COZYSTACK_CI_PRIVATE_KEY }}
256+ owner : cozystack
257+
242258 - name : Parse tag
243259 id : tag
244260 uses : actions/github-script@v7
@@ -261,7 +277,7 @@ jobs:
261277 ref : main
262278 fetch-depth : 0
263279 fetch-tags : true
264- token : ${{ secrets.GH_PAT }}
280+ token : ${{ steps.app-token.outputs.token }}
265281
266282 - name : Check if changelog already exists
267283 id : check_changelog
@@ -289,19 +305,19 @@ jobs:
289305 if : steps.check_changelog.outputs.exists == 'false'
290306 env :
291307 COPILOT_GITHUB_TOKEN : ${{ secrets.COPILOT_GITHUB_TOKEN }}
292- GH_TOKEN : ${{ secrets.GH_PAT }}
308+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
293309 run : |
294310 copilot --prompt "prepare changelog file for tagged release v${{ steps.tag.outputs.version }}, use @docs/agents/changelog.md for it. Create the changelog file at docs/changelogs/v${{ steps.tag.outputs.version }}.md" \
295311 --allow-all-tools --allow-all-paths < /dev/null
296312
297313 - name : Create changelog branch and commit
298314 if : steps.check_changelog.outputs.exists == 'false'
299315 env :
300- GH_PAT : ${{ secrets.GH_PAT }}
316+ APP_TOKEN : ${{ steps.app-token.outputs.token }}
301317 run : |
302- git config user.name "cozystack-bot"
303- git config user.email "217169706 [email protected] " 304- git remote set-url origin https://cozystack-bot :${GH_PAT }@github.com/${GITHUB_REPOSITORY}
318+ git config user.name "cozystack-ci[ bot] "
319+ git config user.email "3297617 +cozystack-ci[ bot] @users.noreply.github.com"
320+ git remote set-url origin https://x-access-token :${APP_TOKEN }@github.com/${GITHUB_REPOSITORY}
305321
306322 CHANGELOG_FILE="docs/changelogs/v${{ steps.tag.outputs.version }}.md"
307323 CHANGELOG_BRANCH="changelog-v${{ steps.tag.outputs.version }}"
@@ -336,7 +352,7 @@ jobs:
336352 if : steps.check_changelog.outputs.exists == 'false'
337353 uses : actions/github-script@v7
338354 with :
339- github-token : ${{ secrets.GH_PAT }}
355+ github-token : ${{ steps.app-token.outputs.token }}
340356 script : |
341357 const version = '${{ steps.tag.outputs.version }}';
342358 const changelogBranch = `changelog-v${version}`;
@@ -395,6 +411,14 @@ jobs:
395411 permissions :
396412 contents : read
397413 steps :
414+ - name : Generate GitHub App token
415+ id : app-token
416+ uses : actions/create-github-app-token@v1
417+ with :
418+ app-id : ${{ secrets.COZYSTACK_CI_APP_ID }}
419+ private-key : ${{ secrets.COZYSTACK_CI_PRIVATE_KEY }}
420+ owner : cozystack
421+
398422 - name : Parse tag
399423 id : tag
400424 uses : actions/github-script@v7
@@ -414,19 +438,19 @@ jobs:
414438 uses : actions/checkout@v4
415439 with :
416440 repository : cozystack/website
417- token : ${{ secrets.GH_PAT }}
441+ token : ${{ steps.app-token.outputs.token }}
418442 ref : main
419443
420444 - name : Update docs from release branch
421445 env :
422- GH_TOKEN : ${{ secrets.GH_PAT }}
446+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
423447 run : make update-all BRANCH=release-${{ steps.tag.outputs.version }} RELEASE_TAG=${{ steps.tag.outputs.tag }}
424448
425449 - name : Commit and push
426450 id : commit
427451 run : |
428- git config user.name "cozystack-bot"
429- git config user.email "217169706 [email protected] " 452+ git config user.name "cozystack-ci[ bot] "
453+ git config user.email "3297617 +cozystack-ci[ bot] @users.noreply.github.com"
430454 git add content
431455 if git diff --cached --quiet; then
432456 echo "No changes to commit"
@@ -443,7 +467,7 @@ jobs:
443467 - name : Open pull request
444468 if : steps.commit.outputs.changed == 'true'
445469 env :
446- GH_TOKEN : ${{ secrets.GH_PAT }}
470+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
447471 run : |
448472 BRANCH="update-docs-v${{ steps.tag.outputs.version }}"
449473 pr_state=$(gh pr view "$BRANCH" --repo cozystack/website --json state --jq .state 2>/dev/null || echo "")
0 commit comments