Repository navigation
65 lines (59 loc) · 2.65 KB
/
Copy pathaccessibility-credits.yml
File metadata and controls
65 lines (59 loc) · 2.65 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
name: Accessibility credits
# Rule 2 of this project's accessibility practice (ACCESSIBILITY.md,
# recognition; Open Source Accessibility Framework, Community action 4).
#
# - A merged pull request with the accessibility label, or one that closes an
# accessibility issue, from someone who is not a maintainer or a bot; and an
# accessibility report closed as completed with a documented outcome: one
# question asking the contributor whether and how to be credited, label
# "credit: asked". Never asked twice on the same item.
# - The contributor, and only the contributor, replies "credit: @handle",
# "credit: name <Name>", "credit: anonymous" or "credit: no": the label
# becomes "credit: yes", "credit: anonymous" or "credit: no", with a short
# confirmation. A chosen name is stored only in that confirmation.
# - At release time, node .github/scripts/a11y-credits.mjs --since <tag-or-date>
# prints the credits block for the release notes.
#
# pull_request_target is used so the question can be posted on pull requests
# from forks. It checks out only the base branch's .github folder and never
# runs code from the pull request.
on:
pull_request_target:
types: [closed]
issues:
types: [closed]
issue_comment:
types: [created]
# pull-requests: write is needed only because GitHub requires it to comment on,
# and label, a pull request; issues: write alone is enough for issues.
permissions:
contents: read
issues: write
pull-requests: write
concurrency:
group: accessibility-credits-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
jobs:
credit:
# The label name repeats accessibilityLabel in .github/a11y-community.json.
if: >-
github.repository_owner == 'Community-Access' && (
(github.event_name == 'pull_request_target' && github.event.pull_request.merged) ||
(github.event_name == 'issues' && github.event.sender.type != 'Bot' &&
contains(github.event.issue.labels.*.name, 'accessibility')) ||
(github.event_name == 'issue_comment' && github.event.sender.type != 'Bot' &&
contains(join(github.event.issue.labels.*.name, ','), 'credit: ')))
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out the rule
uses: actions/checkout@v4
with:
persist-credentials: false
sparse-checkout: .github
- name: Apply the rule
uses: actions/github-script@v8
with:
script: |
const { runFromAction } = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/a11y-community.mjs`);
await runFromAction({ github, context, core }, 'credits');