Fix :oddliest #855
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); |