Update sites list workflow (#2303)

This commit is contained in:
Soxoj
2026-03-22 20:59:37 +01:00
committed by GitHub
parent 959b2be136
commit b8ada1c818
+21 -15
View File
@@ -1,9 +1,8 @@
name: Update sites rating and statistics name: Update sites rating and statistics
on: on:
pull_request: push:
branches: [ dev ] branches: [ main ]
types: [opened, synchronize]
jobs: jobs:
build: build:
@@ -12,7 +11,6 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2.3.2 uses: actions/checkout@v2.3.2
with: with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: build application - name: build application
@@ -20,15 +18,23 @@ jobs:
pip3 install . pip3 install .
python3 ./utils/update_site_data.py --empty-only python3 ./utils/update_site_data.py --empty-only
- name: Commit and push changes - name: Check for meaningful changes
id: check
run: | run: |
git config --global user.name "Maigret autoupdate" REAL_CHANGES=$(git diff --unified=0 sites.md | grep '^[+-][^+-]' | grep -v 'The list was updated at' | wc -l)
git config --global user.email "soxoj@protonmail.com" if [ "$REAL_CHANGES" -gt 0 ]; then
echo `git name-rev ${{ github.event.pull_request.head.sha }} --name-only` echo "has_changes=true" >> $GITHUB_OUTPUT
export BRANCH=`git name-rev ${{ github.event.pull_request.head.sha }} --name-only | sed 's/remotes\/origin\///'` else
echo $BRANCH echo "has_changes=false" >> $GITHUB_OUTPUT
git remote -v fi
git checkout $BRANCH
git add sites.md - name: Create Pull Request
git commit -m "Updated site list and statistics" if: steps.check.outputs.has_changes == 'true'
git push origin $BRANCH uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Updated site list and statistics"
title: "Automated Sites List Update"
body: "Automated changes to sites.md based on new Alexa rankings/statistics."
branch: "auto/update-sites-list"
delete-branch: true