-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
84 lines (79 loc) · 3.21 KB
/
action.yml
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
name: axe DevHub
description: Get the axe DevHub status for a commit
inputs:
api_key:
description: axe DevHub API Key
required: true
server_url:
description: axe server URL
required: false
default: https://axe.deque.com
retry_count:
description: number of times to attempt fetching the commit status
required: false
default: 10
enable_a11y_threshold:
description: Enable the a11y threshold, which will cause the action to fail if the number of violations is greater than the threshold
required: false
default: "false"
github_token:
description: GitHub token
default: ${{ github.token }}
required: true
outputs:
project:
description: Project name
value: ${{ steps.main.outputs.project }}
axe_url:
description: Axe URL for the commit's issues
value: ${{ steps.main.outputs.axe_url }}
issue_count:
description: Number of violations found
value: ${{ steps.main.outputs.issue_count }}
issues_over_a11y_threshold:
description: Whether the number of violations is over your a11y threshold
value: ${{ steps.main.outputs.issues_over_a11y_threshold }}
runs:
using: composite
steps:
- uses: jwalton/gh-find-current-pr@89ee5799558265a1e0e31fab792ebb4ee91c016b # tag=v1
id: find_pr
- id: main
run: ${{ github.action_path }}/main.sh
shell: bash
env:
API_KEY: ${{ inputs.api_key }}
SERVER_URL: ${{ inputs.server_url }}
RETRY_COUNT: ${{ inputs.retry_count }}
COMMIT_SHA: ${{ github.sha }}
ENABLE_A11Y_THRESHOLD: ${{ inputs.enable_a11y_threshold }}
# Add a comment reporting the number of violations.
- if: ${{ failure() && inputs.enable_a11y_threshold == 'true' }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # tag=v2
with:
header: axe-devhub
message: |
axe DevHub found **${{ steps.main.outputs.issue_count }}** accessibility violations in this PR.
axe DevHub found **${{ steps.main.outputs.issues_over_a11y_threshold }}** accessibility violations over your a11y threshold in this PR.
See the full report on [axe DevHub](${{ steps.main.outputs.axe_url }}).
GITHUB_TOKEN: ${{ inputs.github_token }}
number: ${{ steps.find_pr.outputs.pr }}
# Add a comment reporting the number of violations.
- if: ${{ failure() && inputs.enable_a11y_threshold == 'false' }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # tag=v2
with:
header: axe-devhub
message: |
axe DevHub found **${{ steps.main.outputs.issue_count }}** accessibility violations in this PR.
See the full report on [axe DevHub](${{ steps.main.outputs.axe_url }}).
GITHUB_TOKEN: ${{ inputs.github_token }}
number: ${{ steps.find_pr.outputs.pr }}
# Hide a previously added comment if there are no violations.
- if: ${{ success() }}
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # tag=v2
with:
header: axe-devhub
hide: true
hide_classify: OUTDATED
GITHUB_TOKEN: ${{ inputs.github_token }}
number: ${{ steps.find_pr.outputs.pr }}