Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/sync-release-to-pg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,36 @@ jobs:
- name: Push changes
if: env.MERGE_CONFLICT == 'false'
run: |
git push origin pg
set -e
git push origin pg || echo "PUSH_FAILURE=true" >> $GITHUB_ENV

- name: Capture push failure message
if: env.PUSH_FAILURE == 'true'
run: |
# Capture the last git error message
push_error_message=$(git push origin pg 2>&1 | tail -n 1)
echo "PUSH_ERROR_MESSAGE=$push_error_message" >> $GITHUB_ENV

- name: Notify on push failure
if: env.PUSH_FAILURE == 'true'
env:
SLACK_MESSAGE: "Push to pg branch failed: ${{ env.PUSH_ERROR_MESSAGE }}"
run: |
# Format the Slack message
slack_message="${{ env.SLACK_MESSAGE }}"

# Set the Slack message body with channel ID and text
body="$(jq -nc \
--arg channel C07JMLWEXDJ \
--arg text "$slack_message" \
'$ARGS.named'
)"

# Send the message to Slack
curl -v https://slack.com/api/chat.postMessage \
--header "Authorization: Bearer ${{ secrets.SLACK_APPSMITH_ALERTS_TOKEN }}" \
--header "Content-Type: application/json; charset=utf-8" \
--data-raw "$body"

- name: Notify on merge conflicts
if: env.MERGE_CONFLICT == 'true'
Expand Down