Jarelllama's Scam Blocklist #306
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: Check blocklist | |
on: | |
issues: | |
types: | |
- labeled | |
permissions: | |
contents: write | |
issues: write | |
jobs: | |
check-blocklist: | |
if: ${{ github.event.label.name == 'check blocklist' }} | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 180 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Check blocklist | |
run: | | |
# On error | |
trap 'gh issue comment ${{ github.event.issue.number }} -b \ | |
"An error occurred while checking the blocklist." \ | |
&& gh issue edit ${{ github.event.issue.number }} \ | |
--remove-label "check blocklist" --remove-label "checking" \ | |
--add-label "errored"' ERR | |
# Add 'checking' label | |
gh issue edit ${{ github.event.issue.number }} \ | |
--remove-label 'check blocklist' --add-label 'checking' | |
# Generate report for blocklist | |
bash scripts/check.sh "$(grep 'http' <<< "${{ github.event.issue.body }}")" | |
# Comment report and close issue | |
gh issue close ${{ github.event.issue.number }} -c \ | |
"$(cat data/TEMPLATE.md)" | |
# Update issue title and label | |
title="$(mawk -F '*' '/Report for/ {print $2}' data/TEMPLATE.md)" | |
gh issue edit ${{ github.event.issue.number }} -t "$title" \ | |
--remove-label 'checking' --add-label 'report generated' | |
env: | |
GH_TOKEN: ${{ github.token }} |