ci: add configs for release to pg sync (#35914)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Workflow Improvements**
- Enhanced GitHub Actions workflow for syncing releases, improving Git
operations and conflict management.
- Introduced a step to set Git configuration for better commit
attribution.
- Added a new step to specify the Node.js version for consistent
environment setup.
- Simplified the merging process with a new `git merge` command that
accommodates unrelated histories.
- Adjusted conflict handling strategy, emphasizing manual intervention
when conflicts occur.
	- Updated Slack notification message formatting for clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- This is an auto-generated comment: Cypress test results  -->
> [!WARNING]
> Tests have not run on the HEAD
f30933c3d2da9b90ed631f89fc270834505a3873 yet
> <hr>Tue, 03 Sep 2024 04:18:19 UTC
<!-- end of auto-generated comment: Cypress test results  -->
This commit is contained in:
Anagh Hegde 2024-09-04 11:23:58 +05:30 committed by GitHub
parent 5bed1fcf83
commit 95537e0470
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,9 +14,13 @@ jobs:
uses: actions/checkout@v3
with:
ref: release # Checkout the release branch
fetch-depth: 0
- name: Fetch all branches
run: git fetch origin pg
- name: Set Git config values
run: |
git config pull.rebase false
git config user.email "automated@github.com"
git config user.name "Automated Github Action"
- name: Checkout pg branch
run: git checkout pg
@ -24,16 +28,12 @@ jobs:
- name: Merge release to pg
id: merge_commits
run: |
PG_HEAD=$(git rev-parse pg)
RELEASE_HEAD=$(git rev-parse release)
echo "PG_HEAD=$PG_HEAD"
echo "RELEASE_HEAD=$RELEASE_HEAD"
# Checkout the pg branch
git checkout pg
# Attempt to merge release into pg
if ! git merge release; then
echo "Merge conflict detected during merge"
@ -42,7 +42,6 @@ jobs:
CONFLICTING_COMMIT=$(git log -1 --pretty=format:"%H")
echo "CONFLICTING_COMMIT=$CONFLICTING_COMMIT" >> $GITHUB_ENV
git merge --abort
echo "MERGE_CONFLICT=true" >> $GITHUB_ENV
else
echo "MERGE_CONFLICT=false" >> $GITHUB_ENV
@ -68,6 +67,8 @@ jobs:
# This unwieldy horror of a sed command, converts standard Markdown links to Slack's unwieldy link syntax.
slack_message="$(echo "$message" | sed -E 's/\[([^]]+)\]\(([^)]+)\)/<\2|\1>/g')"
echo "$slack_message"
# This is the ChannelId of the proj postgres channel.
body="$(jq -nc \
--arg channel C06Q3A97USE \