Skip to content

Commit

Permalink
modify workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenSHorton committed May 13, 2024
1 parent 332fbb2 commit 2d22b9b
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/release-to-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,29 @@ jobs:
- name: Attempt to merge each commit individually
run: |
FAILED=false
for COMMIT_HASH in ${{ steps.commits.outputs.commits_list }}
do
git cherry-pick $COMMIT_HASH || FAILED=true
if [ "$FAILED" = true ]; then
git cherry-pick --abort
echo "Conflicts detected for commit $COMMIT_HASH. Creating a pull request."
BRANCH_NAME="conflict-${COMMIT_HASH}"
git checkout -b $BRANCH_NAME
git cherry-pick $COMMIT_HASH
git push origin $BRANCH_NAME
gh pr create --base development --head $BRANCH_NAME --title "Resolve Conflict for Commit $COMMIT_HASH" --body "This PR is created to resolve conflicts for commit $COMMIT_HASH."
git checkout development
FAILED=false
git cherry-pick $COMMIT_HASH
if [ $? -ne 0 ]; then # Check if cherry-pick failed
if git diff --cached --exit-code; then # Check if there are changes to commit
echo "Cherry-pick resulted in no changes, skipping..."
git cherry-pick --skip
else
echo "Conflicts detected for commit $COMMIT_HASH, creating a pull request."
git cherry-pick --abort
BRANCH_NAME="conflict-${COMMIT_HASH}"
git checkout -b $BRANCH_NAME
git cherry-pick $COMMIT_HASH
# Handle if cherry-pick is still problematic
if git diff --cached --exit-code; then
git commit --allow-empty -m "Handle empty cherry-pick for commit $COMMIT_HASH"
else
git commit -m "Apply changes for commit $COMMIT_HASH"
fi
git push origin $BRANCH_NAME
gh pr create --base development --head $BRANCH_NAME --title "Resolve Conflict for Commit $COMMIT_HASH" --body "This PR is created to resolve conflicts for commit $COMMIT_HASH."
git checkout development
fi
else
git push origin development
fi
Expand Down

0 comments on commit 2d22b9b

Please sign in to comment.