1212# - A11Y_THRESHOLD: minimum score to pass without warnings
1313# - A11Y_FAIL_THRESHOLD: score below which the workflow fails
1414# - SARIF category: accessibility-scan/<label>
15- #
16- # Lab references: Lab 04, Lab 07, Lab 08
1715# ============================================================================
1816# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
1917name : Accessibility Scan
@@ -130,12 +128,14 @@ jobs:
130128 const sourceFile = urlToSourceFile(page.url || "${{ matrix.scan-url.url }}");
131129 for (const violation of (page.violations || [])) {
132130 if (!rulesMap.has(violation.id)) {
131+ const allTags = ["accessibility"].concat(violation.tags || []).slice(0, 10);
133132 rulesMap.set(violation.id, {
134133 id: violation.id,
135134 shortDescription: { text: violation.help || violation.id },
136135 fullDescription: { text: violation.description || "" },
137- help: { text: violation.help || "", markdown: violation.helpUrl ? `${violation.help || ""}. [Learn more](${violation.helpUrl})` : violation.help || "" },
138- properties: { tags: ["accessibility"].concat(violation.tags || []) }
136+ helpUri: violation.helpUrl || undefined,
137+ help: { text: violation.helpUrl ? `${violation.help || ""}. Learn more: ${violation.helpUrl}` : (violation.help || ""), markdown: violation.helpUrl ? `${violation.help || ""}. [Learn more](${violation.helpUrl})` : (violation.help || "") },
138+ properties: { tags: allTags }
139139 });
140140 }
141141 const weight = impactToWeight[violation.impact] || 1;
@@ -179,8 +179,28 @@ jobs:
179179 sarif_file : a11y-results.sarif
180180 category : accessibility-scan/${{ matrix.scan-url.label }}
181181
182- - name : Threshold gate
182+ - name : Save results for threshold gate
183183 if : always()
184+ uses : actions/upload-artifact@v4
185+ with :
186+ name : a11y-sarif-${{ matrix.scan-url.label }}
187+ path : a11y-results.sarif
188+ if-no-files-found : ignore
189+
190+ a11y-gate :
191+ name : Accessibility — Threshold Gate
192+ runs-on : ubuntu-latest
193+ needs : a11y-scan
194+ if : always()
195+ steps :
196+ - name : Download SARIF results
197+ uses : actions/download-artifact@v4
198+ continue-on-error : true
199+ with :
200+ pattern : a11y-sarif-*
201+ merge-multiple : true
202+
203+ - name : Evaluate thresholds
184204 run : |
185205 if [ -f a11y-results.sarif ]; then
186206 CRITICAL_COUNT=$(jq '[.runs[].results[] | select(.level == "error")] | length' a11y-results.sarif 2>/dev/null || echo "0")
@@ -198,4 +218,6 @@ jobs:
198218 echo "::error::Accessibility score $SCORE is below minimum threshold ${{ env.A11Y_FAIL_THRESHOLD }}"
199219 exit 1
200220 fi
221+ else
222+ echo "No SARIF results found — skipping threshold check"
201223 fi
0 commit comments