-
-
Notifications
You must be signed in to change notification settings - Fork 7
73 lines (62 loc) · 2.2 KB
/
generate.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Generate the blacklist
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
permissions:
contents: write # Adjusted for release creation
id-token: write
jobs:
Generate-Blacklist:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 1
ref: main
- name: Install Python Dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install tldextract tqdm
- name: Generate blacklist
run: /bin/bash generate.sh # removed sudo
- name: Extract current blacklist.txt
run: |
mkdir current
mv all.fqdn.blacklist current/all.fqdn.blacklist
mv current/all.fqdn.blacklist current/blacklist.txt
- name: Count domains in blacklist
id: count_domains
run: |
count=$(wc -l < current/blacklist.txt)
echo "Number of domains: $count"
echo "count=$count" >> $GITHUB_OUTPUT
- name: Delete Release if Exists
run: |
release_id=$(curl -H "Authorization: token ${{ secrets.PAT }}" -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/latest" | jq .id)
if [ "$release_id" != "null" ]; then
curl -X DELETE -H "Authorization: token ${{ secrets.PAT }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/$release_id"
fi
- name: Create Release
id: create_release
uses: actions/[email protected]
with:
tag_name: latest
release_name: "Domains Blacklist"
body: "Domains: ${{ steps.count_domains.outputs.count }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Upload Release Asset (Blacklist)
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./current/blacklist.txt
asset_name: blacklist.txt
asset_content_type: text/plain
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
- name: Clean up
run: rm -r current