Skip to content
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

feat: ms teams notifications logic from onroutebc #2100

Merged
merged 1 commit into from
Sep 25, 2024
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
64 changes: 64 additions & 0 deletions .github/workflows/notifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Notifications
on:
workflow_run:
workflows: [PR,Merge]
types:
- completed
jobs:
notify-teams-pr:
if: ${{github.event.workflow_run.event == 'pull_request'}}
runs-on: ubuntu-22.04
steps:
- uses: simbo/msteams-message-card-action@latest
with:
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
title: "${{github.event.workflow_run.head_commit.message}}"
message: "${{github.event.workflow_run.head_commit.message}}"
color: 'dodger blue'
buttons: |
Pull Request ${{github.event.workflow_run.pull_requests[0].number}} ${{github.event.workflow_run.repository.html_url}}/pull/${{github.event.workflow_run.pull_requests[0].number}}
Diff ${{github.event.workflow_run.repository.html_url}}/pull/${{github.event.workflow_run.pull_requests[0].number}}/files
sections: |
-
activity:
title: ${{github.event.workflow_run.head_commit.committer.name}}
subtitle: ${{github.event.workflow_run.head_commit.timestamp}}
image: ${{github.event.workflow_run.head_repository.owner.avatar_url}}
text: PR Opened
notify-teams-merged:
if: ${{github.event.workflow_run.event == 'push'}}
runs-on: ubuntu-22.04
steps:
- name: PR Number
id: pr
shell: bash
run: |
pr=$(\
curl -sL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls \
| jq .[0].number
)
if [ -z "${pr}" ]
then
echo "No PR number found. Was this push triggered by a squashed PR merge?"
pr=""
fi
echo "pr=${pr}" >> $GITHUB_OUTPUT
- uses: simbo/msteams-message-card-action@latest
with:
webhook: ${{ vars.MS_TEAMS_WEBHOOK_URI }}
title: "${{github.event.workflow_run.head_commit.message}}"
message: "${{github.event.workflow_run.head_commit.message}}"
color: 'dark orange'
summary: "${{github.event.workflow_run.event}}-${{github.event.workflow_run.status}}"
buttons: |
Pull Request ${{steps.pr.outputs.pr}} ${{github.event.workflow_run.repository.html_url}}/pull/${{steps.pr.outputs.pr}}
Diff ${{github.event.workflow_run.repository.html_url}}/pull/${{steps.pr.outputs.pr}}/files
sections: |
-
activity:
title: ${{github.event.workflow_run.head_commit.committer.name}}
subtitle: ${{github.event.workflow_run.head_commit.timestamp}}
image: ${{github.event.workflow_run.head_repository.owner.avatar_url}}
text: Merged
Loading