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