-
Notifications
You must be signed in to change notification settings - Fork 1k
[PM-32685] Send cherry-pick slack message to QA #7151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| name: Send Slack Notification | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - release/**/* | ||
|
|
||
| permissions: | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| send_notification: | ||
| name: Send Slack Notification | ||
| runs-on: ubuntu-24.04 | ||
| # Only run on pushes that carry new commits (or a manual dispatch); | ||
| # skip bare branch-creation pushes that have no commits | ||
| if: ${{ github.event_name != 'push' || github.event.head_commit != null }} | ||
| steps: | ||
| - name: Log in to Azure | ||
| uses: bitwarden/gh-actions/azure-login@main | ||
| with: | ||
| subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| tenant_id: ${{ secrets.AZURE_TENANT_ID }} | ||
| client_id: ${{ secrets.AZURE_CLIENT_ID }} | ||
|
|
||
| - name: Retrieve Slack secrets | ||
| id: retrieve-slack-secrets | ||
| uses: bitwarden/gh-actions/get-keyvault-secrets@main | ||
| with: | ||
| keyvault: gh-android | ||
| secrets: "SLACK-WEBHOOK-TEAM-ENG-MOBILE" | ||
|
|
||
| - name: Log out from Azure | ||
| uses: bitwarden/gh-actions/azure-logout@main | ||
|
|
||
| - name: Build message | ||
| id: msg | ||
| env: | ||
| COMMIT_URL: ${{ github.event.head_commit.url }} | ||
| COMMIT_SHA: ${{ github.event.head_commit.id }} | ||
| run: | | ||
| echo "text=:cherry-pick: <${COMMIT_URL}|${COMMIT_SHA}> into *${GITHUB_REF_NAME}*\ncc <!subteam^S022CDR7W2Z> <@U06538MSPJP>" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Send slack notification | ||
| uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1 | ||
| with: | ||
| webhook: ${{ steps.retrieve-slack-secrets.outputs.SLACK-WEBHOOK-TEAM-ENG-MOBILE }} | ||
| webhook-type: incoming-webhook | ||
| payload: | | ||
| text: "${{ steps.msg.outputs.text }}" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β QUESTION: On
workflow_dispatch,github.event.head_commitis null, so this sends a malformed message to QA.Details
The
ifcondition on line 18 (github.event_name != 'push' || ...) intentionally lets manual dispatch runs through. But on aworkflow_dispatchevent,github.event.head_commitis null, soCOMMIT_URLandCOMMIT_SHAresolve to empty strings. The resulting Slack message becomes:i.e. an empty link
<|>and no commit reference, which still pings@group-qa.Is
workflow_dispatchintended only for testing? If so, consider gating the message-build/send behind a push event, or populating the commit fields fromgithub.shaas a fallback so a manual run doesn't ping QA with an empty commit link.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for testing and will be removed later