-
-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (45 loc) · 1.47 KB
/
add_domains.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
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