Skip to content
Merged
Show file tree
Hide file tree
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
Binary file added .github/workflows/assets/turing_team_pr_bot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions .github/workflows/notify-pr-closed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Notify Teams on PR

on:
pull_request:
types: [closed]

jobs:
notify-teams:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Compute added/removed lines for notification
id: diff
run: |
PR_DATA=$(gh pr view "${{ github.event.pull_request.number }}" --json additions,deletions -q '.')
ADDITIONS=$(echo "$PR_DATA" | jq '.additions')
DELETIONS=$(echo "$PR_DATA" | jq '.deletions')
echo "additions=$ADDITIONS" >> $GITHUB_OUTPUT
echo "deletions=$DELETIONS" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify Microsoft Teams
uses: softwareone-platform/notify-pr-teams-action@v4
with:
webhook_url: ${{ secrets.TEAMS_WEBHOOK_URL }}
bot_image_url: https://raw.githubusercontent.com/softwareone-platform/mpt-api-python-client/main/.github/workflows/assets/turing_team_pr_bot.png
repo: ${{ github.repository }}
pr_url: ${{ github.event.pull_request.html_url }}
pr_title: ${{ github.event.pull_request.title }}
pr_author: ${{ github.event.pull_request.user.login }}
head_ref: ${{ github.event.pull_request.head.ref }}
base_ref: ${{ github.event.pull_request.base.ref }}
commits: ${{ github.event.pull_request.commits }}
changed_files: ${{ github.event.pull_request.changed_files }}
additions: ${{ steps.diff.outputs.additions }}
deletions: ${{ steps.diff.outputs.deletions }}
pr_number: ${{ github.event.pull_request.number }}
pr_status: ${{ github.event.pull_request.state }}
is_merged: ${{ github.event.pull_request.merged }}
34 changes: 34 additions & 0 deletions .github/workflows/notify-pr-reviewed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR Review Notification

on:
pull_request_review:
types: [submitted, edited, dismissed]
Comment thread
svazquezco marked this conversation as resolved.

jobs:
notify-teams:
if: ${{ github.actor != 'coderabbitai[bot]' }}
Comment thread
svazquezco marked this conversation as resolved.
runs-on: ubuntu-latest
steps:
- name: Get Review Comments Count
id: comments
run: |
COMMENTS_COUNT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews/${{ github.event.review.id }}/comments" | jq 'length')
Comment thread
svazquezco marked this conversation as resolved.
echo "count=$COMMENTS_COUNT" >> $GITHUB_OUTPUT

- name: Notify Teams
uses: softwareone-platform/notify-pr-reviews-teams-action@v2
with:
webhook_url: ${{ secrets.TEAMS_WEBHOOK_URL }}
bot_image_url: https://raw.githubusercontent.com/softwareone-platform/mpt-api-python-client/main/.github/workflows/assets/turing_team_pr_bot.png
repo: ${{ github.repository }}
pr_number: ${{ github.event.pull_request.number }}
pr_title: ${{ github.event.pull_request.title }}
reviewer: ${{ github.event.review.user.login }}
review_state: ${{ github.event.review.state }}
global_comment: ${{ github.event.review.body || 'No comment provided' }}
comments_count: ${{ steps.comments.outputs.count }}
head_ref: ${{ github.event.pull_request.head.ref }}
base_ref: ${{ github.event.pull_request.base.ref }}
event: ${{ github.event.action }}
pr_url: ${{ github.event.pull_request.html_url }}
32 changes: 32 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ jobs:
- name: "Run validation & test"
run: make check-all

- name: "Compute added/removed lines for notification"
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
Comment thread
svazquezco marked this conversation as resolved.
id: diff
run: |
PR_DATA=$(gh pr view "${{ github.event.pull_request.number }}" --json additions,deletions -q '.')
Comment thread
svazquezco marked this conversation as resolved.
ADDITIONS=$(echo "$PR_DATA" | jq '.additions')
DELETIONS=$(echo "$PR_DATA" | jq '.deletions')
echo "additions=$ADDITIONS" >> $GITHUB_OUTPUT
echo "deletions=$DELETIONS" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Notify Microsoft Teams"
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
uses: softwareone-platform/notify-pr-teams-action@v4
with:
webhook_url: ${{ secrets.TEAMS_WEBHOOK_URL }}
bot_image_url: https://raw.githubusercontent.com/softwareone-platform/mpt-api-python-client/main/.github/workflows/assets/turing_team_pr_bot.png
repo: ${{ github.repository }}
pr_url: ${{ github.event.pull_request.html_url }}
pr_title: ${{ github.event.pull_request.title }}
pr_author: ${{ github.event.pull_request.user.login }}
head_ref: ${{ github.event.pull_request.head.ref }}
base_ref: ${{ github.event.pull_request.base.ref }}
commits: ${{ github.event.pull_request.commits }}
changed_files: ${{ github.event.pull_request.changed_files }}
additions: ${{ steps.diff.outputs.additions }}
deletions: ${{ steps.diff.outputs.deletions }}
pr_number: ${{ github.event.pull_request.number }}
pr_status: ${{ github.event.pull_request.state }}
is_merged: ${{ github.event.pull_request.merged }}

- name: "Run SonarCloud Scan"
uses: SonarSource/sonarqube-scan-action@v8.2.2
env:
Expand Down
Loading