11name : Release
22
3- # Public repo workflow using token-based checkout to access private npm-release-workflows
3+ # Public repo workflow using GitHub App token to access private npm-release-workflows
4+ # Uses vars.DEV_TOOLS_RELEASE_WORKFLOW_APP_ID and secrets.DEV_TOOLS_RELEASE_WORKFLOW_APP_PRIVATE_KEY
45
56on :
67 workflow_dispatch :
@@ -15,13 +16,22 @@ jobs:
1516 validate :
1617 runs-on : pub-hk-ubuntu-24.04-ip # Options: ubuntu-latest | sfdc-hk-ubuntu-latest | pub-hk-ubuntu-24.04-ip
1718 steps :
19+ # owner scopes the token to the org installation so it can access other repos (e.g. private npm-release-workflows)
20+ - name : Generate GitHub App token
21+ id : app-token
22+ uses : actions/create-github-app-token@v2
23+ with :
24+ app-id : ${{ vars.DEV_TOOLS_RELEASE_WORKFLOW_APP_ID }}
25+ private-key : ${{ secrets.DEV_TOOLS_RELEASE_WORKFLOW_APP_PRIVATE_KEY }}
26+ owner : ${{ github.repository_owner }}
27+
1828 - uses : actions/checkout@v6
1929
2030 - name : Checkout workflows repository
2131 uses : actions/checkout@v6
2232 with :
2333 repository : heroku/npm-release-workflows
24- token : ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }}
34+ token : ${{ steps.app-token.outputs.token }}
2535 path : workflows-repo
2636 ref : main
2737
@@ -49,13 +59,22 @@ jobs:
4959 no_release_needed : ${{ steps.release-workflow.outputs.no_release_needed }}
5060 pr_already_exists : ${{ steps.release-workflow.outputs.pr_already_exists }}
5161 steps :
62+ # owner scopes the token to the org installation so it can access other repos (e.g. private npm-release-workflows)
63+ - name : Generate GitHub App token
64+ id : app-token
65+ uses : actions/create-github-app-token@v2
66+ with :
67+ app-id : ${{ vars.DEV_TOOLS_RELEASE_WORKFLOW_APP_ID }}
68+ private-key : ${{ secrets.DEV_TOOLS_RELEASE_WORKFLOW_APP_PRIVATE_KEY }}
69+ owner : ${{ github.repository_owner }}
70+
5271 - uses : actions/checkout@v6
5372
5473 - name : Checkout workflows repository
5574 uses : actions/checkout@v6
5675 with :
5776 repository : heroku/npm-release-workflows
58- token : ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }}
77+ token : ${{ steps.app-token.outputs.token }}
5978 path : workflows-repo
6079 ref : main
6180
6685 package-manager : yarn # npm | yarn | pnpm
6786 branch_name : ${{ github.ref_name }}
6887 dry_run : ${{ inputs.dry_run }}
69- token : ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }}
88+ token : ${{ steps.app-token.outputs.token }}
7089
7190 publish :
7291 needs : release-please-pr
@@ -77,21 +96,30 @@ jobs:
7796 pull-requests : write
7897 id-token : write
7998 steps :
99+ # owner scopes the token to the org installation so it can access other repos (e.g. private npm-release-workflows)
100+ - name : Generate GitHub App token
101+ id : app-token
102+ uses : actions/create-github-app-token@v2
103+ with :
104+ app-id : ${{ vars.DEV_TOOLS_RELEASE_WORKFLOW_APP_ID }}
105+ private-key : ${{ secrets.DEV_TOOLS_RELEASE_WORKFLOW_APP_PRIVATE_KEY }}
106+ owner : ${{ github.repository_owner }}
107+
80108 - uses : actions/checkout@v6
81109
82110 - name : Checkout workflows repository
83111 uses : actions/checkout@v6
84112 with :
85113 repository : heroku/npm-release-workflows
86- token : ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }}
114+ token : ${{ steps.app-token.outputs.token }}
87115 path : workflows-repo
88116 ref : main
89117
90118 - name : Publish to npm
91119 uses : ./workflows-repo/.github/actions/release-publish-public
92120 with :
93121 package-manager : yarn # npm | yarn | pnpm
94- workflows_token : ${{ secrets.WORKFLOWS_ACCESS_GITHUB_TOKEN }}
122+ workflows_token : ${{ steps.app-token.outputs.token }}
95123 build_command : ' run build'
96124 dry_run : ${{ inputs.dry_run }}
97125 npm_tag : ${{ needs.release-please-pr.outputs.npm_tag }}
0 commit comments