fix: restrict app token generation to internal PRs and add fallback auth token (on PR comments)
| @@ -179,7 +179,10 @@ jobs: | ||
| 179 | 179 | |
| 180 | 180 | steps: |
| 181 | 181 | - name: Mint App Token |
| 182 | + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | |
| 182 | 183 | 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 | |
| 183 | 186 | # Create a GitHub App token |
| 184 | 187 | # https://github.com/marketplace/actions/create-github-app-token |
| 185 | 188 | uses: actions/create-github-app-token@v2 |
| @@ -189,12 +192,13 @@ jobs: | ||
| 189 | 192 | owner: ${{ github.repository_owner }} |
| 190 | 193 | |
| 191 | 194 | - name: Remove Stale Label |
| 195 | + if: always() | |
| 192 | 196 | # 🤖 Issues Helper |
| 193 | 197 | # https://github.com/marketplace/actions/issues-helper |
| 194 | 198 | uses: actions-cool/issues-helper@v3.6.0 |
| 195 | 199 | with: |
| 196 | 200 | actions: 'remove-labels' |
| 197 | 201 | token: ${{ steps.app.outputs.token || github.token }} # Use fallback to GITHUB_TOKEN if app token is not available |
| 198 | 202 | issue-number: ${{ github.event.pull_request.number }} |
| 199 | 203 | labels: '⚰️ Stale' |
| 200 | 204 | |