update #57
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: Checksum | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- 'EasyListHebrew.txt' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Validate existing checksum | |
id: validate_existing_checksum | |
run: | | |
python3 .github/scripts/validateChecksum.py EasyListHebrew.txt || echo "bad_checksum=true" >> $GITHUB_ENV | |
- name: Run checksum update | |
if: ${{ env.bad_checksum == 'true' }} | |
id: update_checksum | |
run: | | |
tmpList=$(mktemp) | |
python3 .github/scripts/addChecksum.py EasyListHebrew.txt $tmpList | |
python3 .github/scripts/validateChecksum.py $tmpList | |
if [ $? -eq 0 ]; then | |
mv -f $tmpList EasyListHebrew.txt | |
else | |
echo "Checksum validation failed after update" | |
exit 1 | |
fi | |
- name: Run genhosts | |
id: genhosts | |
run: python3 .github/scripts/genhosts.py EasyListHebrew.txt | |
- name: Check for changes | |
id: git_status | |
run: | | |
changes=$(git status --porcelain | wc -l) | |
echo "Detected changes: $changes" | |
echo "changes=$changes" >> $GITHUB_OUTPUT | |
- name: Update EasyListHebrew.txt file | |
if: steps.git_status.outputs.changes != '0' | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "[email protected]" | |
git commit -am "Update Checksum" | |
git push origin HEAD |