From 315bf9b8d8671691b5858ab09f6d739791735dbd Mon Sep 17 00:00:00 2001 From: r33drichards Date: Sat, 8 Mar 2025 01:35:04 -0800 Subject: [PATCH 1/2] send to code review requests --- .github/workflows/label-notifications.yml | 70 +++++++++++++++++++ .github/workflows/merged-pr-notifications.yml | 68 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 .github/workflows/label-notifications.yml create mode 100644 .github/workflows/merged-pr-notifications.yml diff --git a/.github/workflows/label-notifications.yml b/.github/workflows/label-notifications.yml new file mode 100644 index 000000000..5ad52b84d --- /dev/null +++ b/.github/workflows/label-notifications.yml @@ -0,0 +1,70 @@ +name: Label Notifications + +on: + label: + types: [created, deleted] + pull_request: + types: [labeled] + +jobs: + notify-slack-needs-review: + if: github.event_name == 'pull_request' && github.event.label.name == 'needs review' + runs-on: ubuntu-latest + steps: + - name: Notify Slack + uses: slackapi/slack-github-action@v1.25.0 + with: + payload: | + { + "text": "Pull Request Needs Review", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🔍 Pull Request Needs Review", + "emoji": true + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}>*" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Author:*\n${{ github.event.pull_request.user.login }}" + }, + { + "type": "mrkdwn", + "text": "*Repository:*\n${{ github.repository }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Description:*\n${{ github.event.pull_request.body }}" + } + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Added by: ${{ github.actor }} | Changes: +${{ github.event.pull_request.additions }} -${{ github.event.pull_request.deletions }}" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + SLACK_CHANNEL: C084HM1MKDW diff --git a/.github/workflows/merged-pr-notifications.yml b/.github/workflows/merged-pr-notifications.yml new file mode 100644 index 000000000..89b165106 --- /dev/null +++ b/.github/workflows/merged-pr-notifications.yml @@ -0,0 +1,68 @@ +name: Merged PR Notifications + +on: + pull_request: + types: [closed] + +jobs: + notify-slack-pr-merged: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Notify Slack + uses: slackapi/slack-github-action@v1.25.0 + with: + payload: | + { + "text": "Pull Request Merged", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "🎉 Pull Request Merged", + "emoji": true + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*<${{ github.event.pull_request.html_url }}|#${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}>*" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Author:*\n${{ github.event.pull_request.user.login }}" + }, + { + "type": "mrkdwn", + "text": "*Repository:*\n${{ github.repository }}" + } + ] + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Description:*\n${{ github.event.pull_request.body }}" + } + }, + { + "type": "context", + "elements": [ + { + "type": "mrkdwn", + "text": "Merged by: ${{ github.actor }} | Changes: +${{ github.event.pull_request.additions }} -${{ github.event.pull_request.deletions }}" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + SLACK_CHANNEL: C084HM1MKDW \ No newline at end of file From c37888c0ed1540ff796cd54626f4b04251cbcfdf Mon Sep 17 00:00:00 2001 From: r33drichards Date: Sat, 8 Mar 2025 01:36:15 -0800 Subject: [PATCH 2/2] Update .github/workflows/label-notifications.yml --- .github/workflows/label-notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-notifications.yml b/.github/workflows/label-notifications.yml index 5ad52b84d..71330ff74 100644 --- a/.github/workflows/label-notifications.yml +++ b/.github/workflows/label-notifications.yml @@ -2,7 +2,7 @@ name: Label Notifications on: label: - types: [created, deleted] + types: [created] pull_request: types: [labeled]