Copy Release Blacklist to repo #16
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: Copy Release Blacklist to gh-pages | |
on: | |
schedule: | |
- cron: '0 * * * *' # Run every hour, you can adjust the schedule as needed | |
workflow_dispatch: | |
jobs: | |
copy-release-blacklist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Download the latest blacklist.txt | |
run: | | |
wget -O latest_blacklist.txt https://github.com/fabriziosalmi/blacklists/releases/latest/download/blacklist.txt | |
continue-on-error: true | |
- name: Check if the file has changed | |
id: check_changes | |
run: | | |
if ! cmp -s latest_blacklist.txt blacklist.txt; then | |
mv latest_blacklist.txt blacklist.txt | |
echo "File updated, copying to gh-pages" | |
else | |
echo "File not updated, no action needed" | |
exit 1 | |
fi | |
continue-on-error: true | |
- name: Commit and push changes to gh-pages | |
if: steps.check_changes.outcome == 'success' | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add blacklist.txt | |
git commit -m "Update blacklist.txt" | |
git pull --rebase origin gh-pages | |
git push origin gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |