-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
95 lines (90 loc) · 3.2 KB
/
Copy pathaction.yml
File metadata and controls
95 lines (90 loc) · 3.2 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
name: "NullToHero Audit Gate"
description: "Deterministic front-end and SEO audit gate. Fails the build on a critical accessibility or crawlability defect, or below a score threshold. Computed checks only; the subjective design verdicts never block a build."
author: "Marius Yvard"
branding:
icon: "check-circle"
color: "purple"
inputs:
url:
description: "URL to audit (mutually exclusive with file and report)."
required: false
default: ""
file:
description: "Local HTML file to audit, relative to the workspace."
required: false
default: ""
report:
description: "Path to an existing SITE-AUDIT.json to gate instead of fetching."
required: false
default: ""
min-score:
description: "Fail if the deterministic floor score is below this (0-100). Empty disables the score gate."
required: false
default: ""
max-warns:
description: "Fail if the number of WARN checks exceeds this. Empty disables."
required: false
default: ""
fail-on-critical:
description: "Fail on any critical-check FAIL (contrast, robots crawlability)."
required: false
default: "true"
render:
description: "Render the page with Playwright before analyzing (needs a URL). Installs Chromium in the action."
required: false
default: "false"
robots:
description: "Also fetch and evaluate robots.txt (URL targets only)."
required: false
default: "true"
outputs:
score:
description: "Deterministic floor score (0-100)."
value: ${{ steps.gate.outputs.score }}
result:
description: "pass or fail."
value: ${{ steps.gate.outputs.result }}
critical-fails:
description: "Number of critical checks that FAILed."
value: ${{ steps.gate.outputs.critical-fails }}
runs:
using: composite
steps:
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "20"
- name: Install Playwright Chromium
if: ${{ inputs.render == 'true' }}
shell: bash
run: npx --yes playwright install --with-deps chromium
- name: Run audit gate
id: gate
shell: bash
env:
IN_URL: ${{ inputs.url }}
IN_FILE: ${{ inputs.file }}
IN_REPORT: ${{ inputs.report }}
IN_MIN_SCORE: ${{ inputs.min-score }}
IN_MAX_WARNS: ${{ inputs.max-warns }}
IN_FAIL_CRIT: ${{ inputs.fail-on-critical }}
IN_RENDER: ${{ inputs.render }}
IN_ROBOTS: ${{ inputs.robots }}
run: |
set -euo pipefail
ARGS=()
if [ -n "$IN_REPORT" ]; then
ARGS+=( --report "$IN_REPORT" )
elif [ -n "$IN_URL" ]; then
ARGS+=( "$IN_URL" )
[ "$IN_RENDER" = "true" ] && ARGS+=( --render )
[ "$IN_ROBOTS" = "true" ] && ARGS+=( --robots )
elif [ -n "$IN_FILE" ]; then
ARGS+=( "$IN_FILE" )
else
echo "::error::Provide one of: url, file, or report"; exit 2
fi
[ -n "$IN_MIN_SCORE" ] && ARGS+=( --min-score "$IN_MIN_SCORE" )
[ -n "$IN_MAX_WARNS" ] && ARGS+=( --max-warns "$IN_MAX_WARNS" )
[ "$IN_FAIL_CRIT" = "false" ] && ARGS+=( --no-fail-on-critical )
node "$GITHUB_ACTION_PATH/tools/audit/gate.mjs" "${ARGS[@]}"