Report domains #94
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: Manually add domains | |
on: | |
issues: | |
types: | |
- labeled | |
permissions: | |
contents: write | |
issues: write | |
jobs: | |
read-domains: | |
if: ${{ github.event.label.name == 'add domains' && github.actor == github.repository_owner }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Read domains from issue | |
run: | | |
mkdir -p data/pending | |
# Get domains, ignoring subdirectories and IP addresses | |
# Note this overrides any previous entries | |
grep -zo 'What domain.*Why should' <<< '${{ github.event.issue.body }}' \ | |
| grep -aPo '^(https?://)?\K[[:alnum:].-]+\.[[:alnum:]-]*[a-z]{2,}[[:alnum:]-]*' \ | |
> data/pending/domains_manual.tmp | |
- name: Close issue | |
run: | | |
gh issue close ${{ github.event.issue.number }} -c \ | |
"Sent the following domains for processing: | |
\`\`\` | |
$(cat data/pending/domains_manual.tmp) | |
\`\`\`" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Push | |
run: | | |
git config user.email ${{ vars.GIT_EMAIL }} | |
git config user.name ${{ vars.GIT_USERNAME }} | |
git add . | |
git diff-index --quiet HEAD || git commit -m "CI: process domains from #${{ github.event.issue.number }}" | |
git push -q | |
build: | |
needs: read-domains | |
uses: ./.github/workflows/retrieve_domains.yml | |
secrets: inherit |