Skip to content

Commit

Permalink
ci: update logic for handling the merge commits (#35898)
Browse files Browse the repository at this point in the history
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags=""

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!CAUTION]  
> If you modify the content in this section, you are likely to disrupt
the CI result for your PR.

<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
  • Loading branch information
AnaghHegde authored Aug 27, 2024
1 parent 5b33768 commit 74685e3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/sync-release-to-pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ jobs:
- name: Get new commits from release
id: get_commits
run: |
COMMITS=$(git log pg..release --oneline | awk '{print $1}')
echo "COMMITS=\"$COMMITS\"" >> $GITHUB_ENV
# Compare the heads of pg and release
PG_HEAD=$(git rev-parse pg)
RELEASE_HEAD=$(git rev-parse release)
echo "PG_HEAD=$PG_HEAD" >> $GITHUB_ENV
echo "RELEASE_HEAD=$RELEASE_HEAD" >> $GITHUB_ENV
# Get new commits on release that are not yet in pg
COMMITS=$(git log --reverse --pretty=format:"%H" $PG_HEAD..$RELEASE_HEAD)
echo "COMMITS=$COMMITS" >> $GITHUB_ENV
- name: Merge commits one by one
id: merge_commits
Expand All @@ -38,12 +46,12 @@ jobs:
# Loop through each commit
for commit in "${commit_array[@]}"; do
echo "Merging commit $commit"
git cherry-pick $commit || {
echo "Attempting to cherry-pick commit $commit"
if ! git cherry-pick $commit; then
echo "Conflict detected with commit $commit"
conflicted_commits+=($commit)
git cherry-pick --abort
}
fi
done
# Save conflicted commits to environment variable
Expand Down

0 comments on commit 74685e3

Please sign in to comment.