Skip to content

sync: synced file(s) with avnet-embedded/ci-automation #77

sync: synced file(s) with avnet-embedded/ci-automation

sync: synced file(s) with avnet-embedded/ci-automation #77

Workflow file for this run

# SPDX-FileCopyrightText: (C) 2024 Avnet Embedded GmbH
# SPDX-License-Identifier: GPL-3.0-only
---
name: Notifications in teams for each PR
on:
pull_request:
types:
- labeled
jobs:
pr_notifications:
runs-on: ubuntu-latest
name: pr_notifications
steps:
- name: Checks out repository
uses: actions/checkout@v5.0.1
with:
token: ${{ secrets.DISPATCH_PAT }}
fetch-depth: 0
- name: get email address
id: email
run: |
echo "email=$(git log -1 --format='%ae' | cut -d '@' -f1 | cut -d '+' -f2)" >> $GITHUB_OUTPUT
- name: Sendgrid
run: |
curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \
-H "Authorization: Bearer $SENDGRID_API_KEY" \
-H 'Content-Type: application/json' \
-d "{
\"from\":{
\"email\":\"notification-pr@simpleswitch.app\"
},
\"personalizations\":[
{
\"to\":[
${{ secrets.LIST_EMAILS_NOTIFICATIONS }}
],
\"dynamic_template_data\":{
\"subject\": \"New PR opened : $PR on ${{ github.repository }}\",
\"author\": \"${{ steps.email.outputs.email }}\",
\"repo\": \"${{ github.repository }}\",
\"source\": \"$SOURCE\",
\"target\": \"$TARGET\",
\"url\": \"${{ github.event.pull_request.html_url }}\",
}
}
],
\"template_id\":\"${{ secrets.EMAIL_TEMPLATE_PR }}\"
}"
env:
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
PR: ${{ github.event.pull_request.title }}
SOURCE: ${{ github.head_ref }}
TARGET: ${{ github.base_ref }}