-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (69 loc) · 2.14 KB
/
whois_update.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
74
75
76
77
78
79
80
81
82
83
84
name: Update WHOIS servers list
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Install Git LFS
run: |
sudo apt-get update && sudo apt-get install -y git-lfs
git lfs install
- name: Check out code
uses: actions/checkout@v4
- name: Git LFS pull
run: git lfs pull
- name: Set up Python from Pipfile
id: python
run: |
echo "version=$(grep python_version Pipfile | cut -d'\"' -f2)" >> $GITHUB_ENV
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies using Pipenv
run: |
cd whois-server-list-generator
pipenv install
- name: Generate updated WHOIS server list
run: |
cd whois-server-list-generator
pipenv run python generate_whois_servers.py
- name: Get current date
id: date
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Commit
run: |
git add -A
git commit -m "Save uncommitted changes" || echo "No changes to commit"
- name: Check for changes in CSV
id: check_changes
run: |
if git diff --quiet whois-servers.csv; then
echo "No changes detected in CSV"
echo "changes=no" >> $GITHUB_ENV
else
echo "Changes detected in CSV"
echo "changes=yes" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes == 'yes'
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Automatically updated on ${{ env.date }}"
title: "Update WHOIS servers list - ${{ env.date }}"
branch: "update-whois-list-${{ env.date }}-${{ github.run_number }}"
labels: automated-pr
- name: PR details
if: env.changes == 'yes'
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Debug Git State
if: failure()
run: |
git status
git log --oneline -n 5