mirror of
https://github.com/RetroDECK/components-template.git
synced 2024-11-27 21:35:37 +00:00
PR: troubleshooting the PR not being created
This commit is contained in:
parent
3e009f583f
commit
3c6b0c498e
21
.github/workflows/pr_from_upstream.yml
vendored
21
.github/workflows/pr_from_upstream.yml
vendored
|
@ -64,29 +64,22 @@ jobs:
|
|||
git push origin --delete "$BRANCH_NAME"
|
||||
fi
|
||||
|
||||
# Perform fetch and merge, attempting to resolve conflicts by preferring the upstream changes
|
||||
# Fetch changes from the upstream repository without merging
|
||||
git fetch "${{ env.UPSTREAM_REPO }}" "${{ env.TARGET_BRANCH }}"
|
||||
|
||||
# Create a new branch and apply the upstream changes
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
git reset --hard FETCH_HEAD
|
||||
|
||||
# Attempt to merge, allowing conflicts
|
||||
if ! git merge FETCH_HEAD -m "Merge changes from upstream ${{ env.UPSTREAM_REPO }}/${{ env.TARGET_BRANCH }}"; then
|
||||
echo "Conflicts detected. Staging conflicted files for the pull request."
|
||||
# Stage all changes, including conflicts
|
||||
git add -A
|
||||
# Commit the merge with conflicts
|
||||
git commit -m "Merge changes from upstream ${{ env.UPSTREAM_REPO }}/${{ env.TARGET_BRANCH }} with conflicts"
|
||||
fi
|
||||
|
||||
# Check if any changes were introduced by the merge
|
||||
if git diff --exit-code "origin/${{ env.TARGET_BRANCH }}"; then
|
||||
echo "No changes detected after merging. Exiting."
|
||||
# Check if there are any changes to commit
|
||||
if git diff --exit-code origin/${{ env.TARGET_BRANCH }}; then
|
||||
echo "No changes detected from upstream. Exiting without creating PR."
|
||||
fi
|
||||
|
||||
- name: Push changes to new branch
|
||||
if: success()
|
||||
run: |
|
||||
git push origin "${{ env.BRANCH_NAME }}"
|
||||
|
||||
|
||||
- name: Create Pull Request
|
||||
if: success()
|
||||
|
|
Loading…
Reference in a new issue