From e95057abf804ce27f1017bcc799ca4c21bb6b709 Mon Sep 17 00:00:00 2001 From: Soxoj <31013580+soxoj@users.noreply.github.com> Date: Sun, 22 Mar 2026 20:59:37 +0100 Subject: [PATCH] Update sites list workflow (#2303) --- .github/workflows/update-site-data.yml | 36 +++++++++++++++----------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/update-site-data.yml b/.github/workflows/update-site-data.yml index 29d069f..f281797 100644 --- a/.github/workflows/update-site-data.yml +++ b/.github/workflows/update-site-data.yml @@ -1,9 +1,8 @@ name: Update sites rating and statistics on: - pull_request: - branches: [ dev ] - types: [opened, synchronize] + push: + branches: [ main ] jobs: build: @@ -12,7 +11,6 @@ jobs: - name: Checkout repository uses: actions/checkout@v2.3.2 with: - ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - name: build application @@ -20,15 +18,23 @@ jobs: pip3 install . python3 ./utils/update_site_data.py --empty-only - - name: Commit and push changes + - name: Check for meaningful changes + id: check run: | - git config --global user.name "Maigret autoupdate" - git config --global user.email "soxoj@protonmail.com" - echo `git name-rev ${{ github.event.pull_request.head.sha }} --name-only` - export BRANCH=`git name-rev ${{ github.event.pull_request.head.sha }} --name-only | sed 's/remotes\/origin\///'` - echo $BRANCH - git remote -v - git checkout $BRANCH - git add sites.md - git commit -m "Updated site list and statistics" - git push origin $BRANCH \ No newline at end of file + REAL_CHANGES=$(git diff --unified=0 sites.md | grep '^[+-][^+-]' | grep -v 'The list was updated at' | wc -l) + if [ "$REAL_CHANGES" -gt 0 ]; then + echo "has_changes=true" >> $GITHUB_OUTPUT + else + echo "has_changes=false" >> $GITHUB_OUTPUT + fi + + - name: Create Pull Request + if: steps.check.outputs.has_changes == 'true' + 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 \ No newline at end of file