|
11 | 11 | jobs: |
12 | 12 | preview: |
13 | 13 | runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/disk=large" |
| 14 | + env: |
| 15 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 16 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
14 | 17 | steps: |
15 | 18 | - uses: actions/checkout@v5 |
16 | 19 | with: |
@@ -168,6 +171,11 @@ jobs: |
168 | 171 | fi |
169 | 172 | - name: Preview Deploy to Netlify |
170 | 173 | id: netlify-deploy |
| 174 | + if: > |
| 175 | + github.actor != 'dependabot[bot]' && |
| 176 | + (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && |
| 177 | + env.NETLIFY_AUTH_TOKEN != '' && |
| 178 | + env.NETLIFY_SITE_ID != '' |
171 | 179 | shell: bash -l {0} |
172 | 180 | run: | |
173 | 181 | if [ "${{ github.event_name }}" = "pull_request" ]; then |
@@ -238,11 +246,16 @@ jobs: |
238 | 246 | echo "🎯 Preview page: ${deploy_url}/${{ github.event.inputs.preview_page }}" |
239 | 247 | fi |
240 | 248 | fi |
241 | | - env: |
242 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
243 | | - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 249 | + - name: Skip Netlify Deploy (no secrets or untrusted actor) |
| 250 | + if: > |
| 251 | + !(github.actor != 'dependabot[bot]' && |
| 252 | + (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && |
| 253 | + env.NETLIFY_AUTH_TOKEN != '' && |
| 254 | + env.NETLIFY_SITE_ID != '') |
| 255 | + run: | |
| 256 | + echo "Skipping Netlify preview deploy: secrets unavailable or actor not trusted (actor=${{ github.actor }})" |
244 | 257 | - name: Post PR Comment with Preview Links |
245 | | - if: github.event_name == 'pull_request' |
| 258 | + if: github.event_name == 'pull_request' && steps.netlify-deploy.outputs.deploy_url != '' |
246 | 259 | uses: actions/github-script@v7 |
247 | 260 | with: |
248 | 261 | script: | |
|
0 commit comments