Skip to content

Update push and pr notification to use Cards v2. - #636

Open
brnnmrls wants to merge 8 commits into
mainfrom
briannamorales/embed-notifs
Open

Update push and pr notification to use Cards v2.#636
brnnmrls wants to merge 8 commits into
mainfrom
briannamorales/embed-notifs

Conversation

@brnnmrls

@brnnmrls brnnmrls commented Sep 9, 2026

Copy link
Copy Markdown
Member

This pull request updates .github/workflows/pr_notification.yml and .github/workflows/push_notification.yml to resolve an issue where notifications rendered as blank message bubbles in Google Chat. These files required updating the the following:

  • deprecated Cards v1 schema
  • unexpanded environment variables inside single-quoted curl commands
  • JSON syntax failures from unescaped quotes or multiline commit messages.

To fix this, both workflows have been migrated to modern Google Chat Cards v2 (cardsV2) utilizing decoratedText and buttonList widgets.

@brnnmrls
brnnmrls requested a review from w-goog September 9, 2026 20:17
@brnnmrls
brnnmrls requested review from w-goog and removed request for w-goog September 9, 2026 21:00
@brnnmrls
brnnmrls requested review from w-goog and removed request for w-goog September 9, 2026 21:09
@brnnmrls
brnnmrls requested review from w-goog and removed request for w-goog September 9, 2026 21:37
@brnnmrls brnnmrls changed the title [DNS] Update push and pr notification to use cardsv2 Update push and pr notification to use Cards v2. Sep 9, 2026

@w-goog w-goog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved assuming feedback is addressed :)


curl --location --request POST "$WEBHOOK_URL" \
--header 'Content-Type: application/json; charset=UTF-8' \
--data "$PAYLOAD"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why the change to --data instead of --data-raw?

}'
}')

curl --location --request POST "$WEBHOOK_URL" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want this to fail a PR, but I do think we want it to indicate that something failed. For both curl commands, you could do all of: a) add --fail-with-body b) Capture the error output, and echo it in the log and c) add continue-on-error: true

{
decoratedText: {
topLabel: "Labels",
text: (if $labels != "" then "- " + $labels else "None" end)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do a little helper function to add this guard on every text in both files - for example, I think it's unlikely that "github.event.head_commit.author.username" will be nil, but it is possible, which would cause this to fail. text is required by v2.

- name: Google Chat Notification
shell: bash
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this will always be nil on PRs that come in from forks, can you add a quick check for WEBHOOK_URL that will skip the workflow if nil?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants