-
-
Notifications
You must be signed in to change notification settings - Fork 178
53 lines (44 loc) · 1.52 KB
/
pof_handler.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
name: Proof-of-work handler
permissions:
issues: write
contents: read
on:
issue_comment:
types: [created]
jobs:
check_comment_job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
- name: Check comment and image
run: |
comment_body=$(jq -r '.comment.body' "$GITHUB_EVENT_PATH")
comment_body_lowercase=$(echo $comment_body | awk '{print tolower($0)}')
if [[ $comment_body_lowercase =~ "(p\-?o\-?f|proof[\-_\s]*of[\-_\s]*work)\:?[\r\n]*.*(\!?\[.*\]\(.+\)|\<?https?:\/\/.)" ]]; then
echo "Found proper pof"
echo "remove_label=true" >> $GITHUB_OUTPUT
else
echo "Proof-of-work invalid or didnt exist"
echo "remove_label=false" >> $GITHUB_OUTPUT
fi
remove_label_job:
needs: check_comment_job
runs-on: ubuntu-latest
steps:
- name: Remove pof label
if: ${{ needs.check_comment_job.outputs.remove_label == 'true' }}
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
async function amogus({ context }) {
const octokit = context.github;
const issue_number = context.payload.issue.number;
await octokit.issues.removeLabel({
...context.repo,
issue_number: issue_number,
name: "⌛needs PoF"
});
}
amogus(require("@actions/github"));