@@ -414,27 +414,38 @@ jobs:
414414 fi
415415 done
416416 rm -rf artifacts/
417- - name : Commit changes
418- id : commit
417+
418+ - name : Commit, Create Branch, and Push
419+ id : branch_push
419420 run : |
420421 if git diff --cached --exit-code; then
422+ echo "No file changes detected. Skipping commit and PR creation."
421423 echo "changed=false" >> $GITHUB_OUTPUT
422424 else
425+ BRANCH_NAME="update-${{ inputs.cache_version }}"
426+
427+ git checkout -b $BRANCH_NAME
423428 git commit -m "Update cache dumps to version ${{ inputs.cache_version }}"
429+
430+ git push origin $BRANCH_NAME --force-with-lease
431+
432+ echo "Changes committed and pushed to $BRANCH_NAME."
424433 echo "changed=true" >> $GITHUB_OUTPUT
434+ echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
425435 fi
436+
426437 - name : Create Pull Request if changes
427- if : steps.commit .outputs.changed == 'true'
438+ if : steps.branch_push .outputs.changed == 'true'
428439 env :
429440 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
430441 run : |
431442 gh pr create \
432443 --base main \
433- --head update- ${{ inputs.cache_version }} \
444+ --head ${{ steps.branch_push.outputs.branch_name }} \
434445 --title "Update cache dumps to version ${{ inputs.cache_version }}" \
435446 --body "Automated cache dump update from OpenRS2 archive.
436447
437448 **Cache Version:** ${{ inputs.cache_version }}
438449
439450 Generated by workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
440- --label automated,cache-update
451+ --label automated,cache-update
0 commit comments