Repository navigation
136 lines (126 loc) · 5.15 KB
/
Copy pathci-debug.yml
File metadata and controls
136 lines (126 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: CI Debug Report
on:
workflow_run:
workflows:
- CI
- Build + Package
- Release
- Release Candidate
- Website Deploy
- Model Supply Chain Validation
- Model Quantization & Validation
- E2E Keyboard Nav
- Visual Baselines
types:
- completed
permissions:
contents: read
actions: read
checks: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: false
jobs:
debug-report:
name: Debug Report
if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out' || github.event.workflow_run.conclusion == 'cancelled'
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
artifact_id: ${{ steps.upload-report.outputs.artifact-id }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
# workflow_run is privileged. Always execute the commenter and
# report generator from the trusted default branch, never from the
# failed PR's checkout.
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
# Probe first. Executed steps in cancelled jobs require log inspection:
# cancellation may have interrupted a run after assertions failed.
# A zero-step cancellation or confirmed startup block supplies no
# executed product failure. Queue age alone does not prove an outage.
- name: Probe for failures or interrupted execution needing inspection
id: probe
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
node scripts/ci-debug.mjs \
--probe \
--run-id ${{ github.event.workflow_run.id }} \
--repo ${{ github.repository }}
- name: Skip report (no executed failure evidence to inspect)
if: steps.probe.outputs.report_required == 'false'
run: |
echo "Run ${{ github.event.workflow_run.id }} has no executed failure evidence requiring a report."
echo "Inspect the probe classification and job annotations before choosing recovery."
- name: Record unavailable probe classification
if: steps.probe.outputs.report_required == ''
run: echo "Probe classification was unavailable; attempting the full diagnostic fetch."
- name: Generate debug report
if: steps.probe.outputs.report_required != 'false'
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
# ci-debug.mjs is dependency-free (Node builtins only) — no pnpm
# install needed. A full `pnpm install --frozen-lockfile` here is
# wasted work AND a single point of failure (if deps are broken the
# debug job itself dies). The report is fetched via the GitHub API.
node scripts/ci-debug.mjs \
--run-id ${{ github.event.workflow_run.id }} \
--repo ${{ github.repository }} \
--output ci-debug-report.md \
--manifest ci-failure-manifest.json
- name: Upload debug report
id: upload-report
if: always() && steps.probe.outputs.report_required != 'false'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: ci-debug-report-${{ github.event.workflow_run.id }}-${{ github.run_id }}-attempt-${{ github.run_attempt }}
path: |
ci-debug-report.md
ci-failure-manifest.json
if-no-files-found: ignore
# PR comments are deliberately posted here, after the failed workflow has
# completed and from the trusted default-branch checkout. The ordinary PR
# jobs run untrusted repository code and therefore never receive issues:write.
post-pr-comment:
name: Post PR debug comment
needs: debug-report
if: >-
needs.debug-report.result == 'success' &&
needs.debug-report.outputs.artifact_id != '' &&
github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
actions: read
checks: read
issues: write
steps:
- name: Checkout trusted default branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
- name: Download generated debug report
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
github-token: ${{ github.token }}
run-id: ${{ github.run_id }}
artifact-ids: ${{ needs.debug-report.outputs.artifact_id }}
path: .
- name: Post debug report to PR
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
node scripts/pr-debug-comment.mjs \
--run-id ${{ github.event.workflow_run.id }} \
--repo ${{ github.repository }} \
--report ci-debug-report.md