@@ -16,30 +16,42 @@ jobs:
1616 # directory in which cookiecuter generates the new repository
1717 INSTANCE_GENERATED : " TEMPLATE_INSTANCE_GENERATED"
1818 PROJECT_NAME : " cookiecutter-scverse-instance"
19- GH_TOKEN : ${{ secrets.BOT_GH_TOKEN }} # for gh cli
19+ APP_USERNAME : " scverse-pr-creator[bot]"
20+ APP_EMAIL : " 272303624+scverse-pr-creator[bot]@users.noreply.github.com"
2021
2122 steps :
22- - name : Checkout template repository
23- uses : actions/checkout@v6
23+ - name : Install the latest version of uv
24+ uses : astral-sh/setup-uv@v7
25+ with :
26+ cache-dependency-glob : .github/workflows/deploy-instance-repo.yml
2427
2528 - name : Set git identity
2629 run : |
27- git config --global user.name "scverse-bot"
28- git config --global user.email "108668866+scverse-bot@users.noreply.github.com"
30+ git config --global user.name "${{ env.APP_USERNAME }}"
31+ git config --global user.email "${{ env.APP_EMAIL }}"
32+
33+ - name : Checkout template repository
34+ uses : actions/checkout@v6
35+
36+ - name : Generate tokens
37+ id : app-token
38+ uses : actions/create-github-app-token@v2
39+ with :
40+ app-id : ${{ vars.PR_CREATOR_APP_ID }}
41+ private-key : ${{ secrets.PR_CREATOR_PRIVATE_KEY }}
42+ repositories : cookiecutter-scverse-instance
43+
44+ - name : Authenticate gh CLI with app token
45+ run : echo "${{ steps.app-token.outputs.token }}" | gh auth login --with-token
2946
3047 - name : Checkout instance repository
3148 uses : actions/checkout@v6
3249 with :
3350 repository : ${{ env.INSTANCE_REPO_GITHUB }}
34- token : ${{ secrets.BOT_GH_TOKEN }}
51+ token : ${{ steps.app-token.outputs.token }}
3552 path : ${{ env.INSTANCE_REPO }}
3653 persist-credentials : true
3754
38- - name : Install the latest version of uv
39- uses : astral-sh/setup-uv@v7
40- with :
41- cache-dependency-glob : .github/workflows/deploy-instance-repo.yml
42-
4355 - name : define sister PR branch name for pull request
4456 if : github.event_name == 'pull_request'
4557 run : |
7991 if : ${{ env.GIT_HAS_CHANGES == 'TRUE' }}
8092 uses : EndBug/add-and-commit@v9
8193 with :
82- default_author : github_actions
94+ author_name : ${{ env.APP_USERNAME }}
95+ author_email : ${{ env.APP_EMAIL }}
96+ default_author : user_info
8397 commit : " --no-verify" # no need to run pre-commit at this point - saves runtime!
8498 cwd : ${{ env.INSTANCE_REPO }}
8599 message : Update instance repo from cookiecutter template
90104 if : ${{ env.GIT_HAS_CHANGES == 'TRUE' }}
91105 uses : ad-m/github-push-action@v0.8.0
92106 with :
93- github_token : ${{ secrets.BOT_GH_TOKEN }}
107+ github_token : ${{ steps.app-token.outputs.token }}
94108 branch : ${{ env.SISTER_PR_BRANCH }}
95109 repository : scverse/cookiecutter-scverse-instance
96110 force : false
@@ -144,6 +158,8 @@ jobs:
144158 [checks]: https://github.com/scverse/cookiecutter-scverse-instance/pull/${{ env.SISTER_PR_ID }}/checks
145159 [docs-badge]: https://app.readthedocs.org/projects/cookiecutter-scverse-instance/badge/?version=${{ env.SISTER_PR_ID }}
146160 [docs]: https://cookiecutter-scverse-instance--${{ env.SISTER_PR_ID }}.org.readthedocs.build/
161+ # use default token, which allows to comment in the cookiecutter-scverse repo.
162+ # The token generated by the app is scoped to the cookiecutter-scverse-instance repo instead.
147163 repo-token : ${{ secrets.GITHUB_TOKEN }}
148164 allow-repeats : false
149165
0 commit comments