Files
AS_Network_List/.github/workflows/bl.yml
2024-03-02 12:23:08 +01:00

55 lines
1.4 KiB
YAML

name: BlackLists updater
env:
GH_PAT: ${{ secrets.GH_PAT }}
REPO_NAME: AS_Network_List
REPO_OWNER: C24Be
on:
workflow_dispatch:
schedule:
# At 00:00 on the first day of the month
#- cron: '0 0 1 * *'
# At 00:00 on Sunday
#- cron: '0 0 * * 0'
# At 00:00 every day
- cron: '0 0 * * *'
# Every hour
#- cron: '0 * * * *'
push:
branches:
- main
jobs:
build:
name: 'BL/Update'
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # this is required to fetch all history for all branches and tags
token: ${{ env.GH_PAT }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: ./requirements.sh
- run: curl -s ifconfig.io
- run: ./blacklists_updater.sh
- name: Push changes back to the repo
run: |
timestamp=`date "+%Y.%m.%d %H:%M:%S"`
git config --global user.name "${{ env.REPO_OWNER }}"
git config --global user.email "${{ env.REPO_OWNER }}@github.com"
git add blacklist*txt
git diff --staged --exit-code || echo "No changes to commit"
if [ $? -ne 0 ]; then
git commit -m "Update $timestamp"
git push https://${{ env.GH_PAT }}@github.com/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}.git
fi