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

Adding notification for PR reviews #185

Merged
merged 2 commits into from
Mar 20, 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
38 changes: 38 additions & 0 deletions .github/workflows/notify_teams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request_target:
branches: [main]
types: [opened, reopened, assigned, closed, ready_for_review, converted_to_draft, review_requested]
pull_request_review:
types: [submitted, edited]



jobs:
Expand Down Expand Up @@ -139,4 +142,39 @@ jobs:
"action": "${{ env.action }}"
}

send_email_on_review:
if: (github.event.action == 'submitted' || github.event.action == 'edited') && github.event.review.state == 'APPROVED'
runs-on: ubuntu-latest
steps:
- name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions

- name: Get PR Data
run: |
echo "number=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "title=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
echo "user=${{ github.event.review.user.login }}" >> $GITHUB_ENV
echo "status=${{ github.event.review.state }}" >> $GITHUB_ENV

- name: Send Email on PR Review
uses: ./actions/.github/actions/send_email
with:
username: ${{ secrets.EMAIL_USERNAME }}
Copy link
Member

Choose a reason for hiding this comment

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

This is the PR submitter's email? Or is it the person who starts the job.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

neither, it is the email address of the mail server that sends the notifications

password: ${{ secrets.EMAIL_PASSWORD }}
to: ${{ secrets.DESTINATION_EMAIL }}
subject: "***Notification*** Reviewed Pull Request: ${{ env.number }}"
body: |
{
"number": "${{ env.number }}",
"title": "${{ env.title }}",
"action": "${{ env.action }}",
"user": "${{ env.user }}",
"status": "${{ env.status }}"
}



Loading