mirror of
https://github.com/RetroDECK/components-template.git
synced 2024-11-24 04:05:39 +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,22 +64,16 @@ jobs:
|
||||||
git push origin --delete "$BRANCH_NAME"
|
git push origin --delete "$BRANCH_NAME"
|
||||||
fi
|
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 }}"
|
git fetch "${{ env.UPSTREAM_REPO }}" "${{ env.TARGET_BRANCH }}"
|
||||||
|
|
||||||
|
# Create a new branch and apply the upstream changes
|
||||||
git checkout -b "$BRANCH_NAME"
|
git checkout -b "$BRANCH_NAME"
|
||||||
|
git reset --hard FETCH_HEAD
|
||||||
|
|
||||||
# Attempt to merge, allowing conflicts
|
# Check if there are any changes to commit
|
||||||
if ! git merge FETCH_HEAD -m "Merge changes from upstream ${{ env.UPSTREAM_REPO }}/${{ env.TARGET_BRANCH }}"; then
|
if git diff --exit-code origin/${{ env.TARGET_BRANCH }}; then
|
||||||
echo "Conflicts detected. Staging conflicted files for the pull request."
|
echo "No changes detected from upstream. Exiting without creating PR."
|
||||||
# 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."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push changes to new branch
|
- name: Push changes to new branch
|
||||||
|
@ -87,7 +81,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git push origin "${{ env.BRANCH_NAME }}"
|
git push origin "${{ env.BRANCH_NAME }}"
|
||||||
|
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: success()
|
if: success()
|
||||||
uses: peter-evans/create-pull-request@v7.0.5
|
uses: peter-evans/create-pull-request@v7.0.5
|
||||||
|
|
Loading…
Reference in a new issue