fix: restrict app token generation to internal PRs and add fallback auth token (on PR comments)

59d4c7f5d753df3eb2018fa90702bd3dd87da98b

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +5 -1Showing whitespace changes
.github/workflows/pr-auto-manager.yml+5 -1
@@ -179,7 +179,10 @@ jobs:
179179
180180 steps:
181181 - name: Mint App Token
182+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
182183 id: app
184+ # Only run if the PR is from the same repository
185+ # This action runs on comments, which will not receive the env vars for this
183186 # Create a GitHub App token
184187 # https://github.com/marketplace/actions/create-github-app-token
185188 uses: actions/create-github-app-token@v2
@@ -189,12 +192,13 @@ jobs:
189192 owner: ${{ github.repository_owner }}
190193
191194 - name: Remove Stale Label
195+ if: always()
192196 # 🤖 Issues Helper
193197 # https://github.com/marketplace/actions/issues-helper
194198 uses: actions-cool/issues-helper@v3.6.0
195199 with:
196200 actions: 'remove-labels'
197201 token: ${{ steps.app.outputs.token || github.token }} # Use fallback to GITHUB_TOKEN if app token is not available
198202 issue-number: ${{ github.event.pull_request.number }}
199203 labels: '⚰️ Stale'
200204