-
Notifications
You must be signed in to change notification settings - Fork 9
35 lines (30 loc) · 1.32 KB
/
adr-proposed.yaml
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
name: ADR proposed
on:
issues:
types:
- labeled
jobs:
main:
name: ADR created
runs-on: ubuntu-latest
# Only run this workflow if the issue is open and has the "ADR" label
if: "${{github.event.issue.state == 'open' && contains(github.event.issue.labels.*.name, 'ADR') }}"
steps:
- name: add comment if appropriate
uses: actions/github-script@v7
with:
script: |
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
const botHasCommented = comments.some(({ user: { login }}) => login === 'github-actions[bot]');
if(!botHasCommented) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This issue appears to be a draft or in-progress ADR. When it is completed and accepted, add the `ADR: Accepted` label and close the issue. This will start a process to create the ADR document and add it to the repo automatically. If you close the issue before adding the label, simply re-open and re-close it.'
});
}