-
Notifications
You must be signed in to change notification settings - Fork 317
38 lines (34 loc) · 1.24 KB
/
reset-metadata-approval.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
name: Reset Approval on Edit
on:
issues:
types:
- edited
jobs:
reset-approval:
if: contains(join(github.event.issue.labels.*.name, ','), 'correction') || contains(join(github.event.issue.labels.*.name, ','), 'metadata')
runs-on: ubuntu-latest
steps:
- name: Leave a comment and reset approval status
uses: actions/github-script@v6
with:
script: |
const { issue, repository } = context.payload;
const owner = repository.owner.login;
const repo = repository.name;
const approvedLabel = "approved";
// Check if the issue has the "approved" label and remove it
if (issue.labels.some(label => label.name === approvedLabel)) {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number: issue.number,
name: approvedLabel
});
// Add a comment to notify about the edit
await github.rest.issues.createComment({
owner,
repo,
issue_number: issue.number,
body: "Approval status has been reset after the issue was edited."
});
}