From b5a1e8c593e0d6be434615f292e09b51ece7199b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Thu, 12 Jun 2025 04:10:34 +0200 Subject: [PATCH] Refactor GitHub Actions workflow --- .gitea/workflows/main.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 802f2ee..f2fbb6e 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -38,15 +38,23 @@ jobs: - name: Run script run: uv run python scrape.py - - name: Pull latest changes before staging + - name: Stage any changes from scraper + run: | + git add -A + + - name: Pull latest changes with rebase run: | git config user.name "Joakim Hellsén" git config user.email "tlovinator@gmail.com" - git pull --rebase https://${{ secrets.REPO_WRITE_PAT }}@git.lovinator.space/TheLovinator/wutheringwaves.git master - - - name: Stage updated/deleted files - run: | - git add -u + # If there are staged changes, commit them temporarily + if ! git diff --cached --quiet; then + git commit -m "Temporary commit for rebase" + git pull --rebase https://${{ secrets.REPO_WRITE_PAT }}@git.lovinator.space/TheLovinator/wutheringwaves.git master + # Reset to unstage the temporary commit but keep the changes + git reset --soft HEAD~1 + else + git pull --rebase https://${{ secrets.REPO_WRITE_PAT }}@git.lovinator.space/TheLovinator/wutheringwaves.git master + fi - name: Get the files that will be committed id: get_modified_files