2525 required : false
2626 default : ' '
2727 type : string
28+ secrets :
29+ app-private-key :
30+ description : >-
31+ Private key of the riseproject-dev GitHub App. Without it the
32+ documentation PR is opened with GITHUB_TOKEN and gets no checks.
33+ required : false
2834
2935concurrency :
3036 group : publish-wheel
@@ -35,10 +41,22 @@ jobs:
3541 publish :
3642 runs-on : ubuntu-latest
3743 steps :
44+ # A branch pushed or a PR opened with GITHUB_TOKEN raises no events, so
45+ # the documentation PR would sit there with no checks. Push and open it
46+ # as the App instead; without its credentials, or on a pull request
47+ # (where nothing is published anyway), this falls back to GITHUB_TOKEN.
48+ - uses : actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
49+ id : app-token
50+ if : ${{ vars.RISEPROJECT_APP_ID != '' && github.ref == 'refs/heads/main' }}
51+ with :
52+ app-id : ${{ vars.RISEPROJECT_APP_ID }}
53+ private-key : ${{ secrets.app-private-key }}
54+
3855 - name : Checkout python-wheels
3956 uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4057 with :
4158 fetch-depth : 0
59+ token : ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
4260
4361 - name : Download wheels
4462 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -136,7 +154,7 @@ jobs:
136154 - name : Create draft release and upload assets
137155 if : github.ref == 'refs/heads/main'
138156 env :
139- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
157+ GH_TOKEN : ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
140158 RELEASE_TAG : ${{ steps.release.outputs.tag }}
141159 RELEASE_TITLE : ${{ steps.release.outputs.title }}
142160 run : |
@@ -166,7 +184,7 @@ jobs:
166184 - name : Verify release is immutable
167185 if : github.ref == 'refs/heads/main'
168186 env :
169- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
187+ GH_TOKEN : ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
170188 run : |
171189 immutable=$(gh api \
172190 "repos/${{ github.repository }}/releases/tags/${{ steps.release.outputs.tag }}" \
@@ -178,7 +196,8 @@ jobs:
178196
179197 - name : Update package documentation
180198 env :
181- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
199+ GH_TOKEN : ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
200+ APP_SLUG : ${{ steps.app-token.outputs.app-slug }}
182201 ARTIFACTS_PATH : ${{ inputs.artifact-path }}
183202 RELEASE_TAG : ${{ steps.release.outputs.tag }}
184203 GPL_SOURCES_DESCRIPTION : ${{ inputs.gpl-sources-description }}
0 commit comments