2626permissions :
2727 contents : read
2828
29- # This allows a subsequently queued workflow run to cancel previous runs
29+ # This allows a subsequently queued workflow run to cancel previous runs.
30+ # Include the triggering workflow's conclusion in the group so that runs triggered
31+ # by skipped Purge Fastly workflows don't cancel runs triggered by successful ones.
3032concurrency :
31- group : ' ${{ github.workflow }} @ ${{ github.head_ref }} ${{ github.event_name }}'
33+ group : ' ${{ github.workflow }} @ ${{ github.head_ref }} ${{ github.event_name }} ${{ github.event.workflow_run.conclusion }} '
3234 cancel-in-progress : true
3335
3436env :
4042
4143jobs :
4244 figureOutMatrix :
43- if : ${{ github.repository == 'github/docs-internal' }}
45+ # Skip immediately if triggered by a non-successful Purge Fastly run.
46+ # This prevents skipped runs from canceling valid indexing runs via concurrency.
47+ if : ${{ github.repository == 'github/docs-internal' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') }}
4448 runs-on : ubuntu-latest
4549 outputs :
4650 matrix : ${{ steps.set-matrix.outputs.result }}
@@ -55,11 +59,13 @@ jobs:
5559 const allPossible = ["en", ...allNonEnglish]
5660
5761 if (context.eventName === "workflow_run") {
62+ // Job-level `if` already ensures we only get here for successful runs,
63+ // but keep this as a safety check.
5864 if (context.payload.workflow_run.conclusion === "success") {
5965 return ["en"]
6066 }
61- console.warn(`NOTE! It was a workflow_run but not success ('${context.payload.workflow_run.conclusion}')`)
62- console.warn("This means we're not going to index anything in the next dependent step." )
67+ // This shouldn't happen due to job-level filter, but handle gracefully.
68+ console.warn(`Unexpected: workflow_run with conclusion '${context.payload.workflow_run.conclusion}'` )
6369 return []
6470 }
6571
0 commit comments