Skip to content

Commit

Permalink
chore(Root): add ship, show, ask workflows for notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
jordevo committed Jan 24, 2024
1 parent c79a566 commit ab104d1
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/notify-pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Notify on Slack about a Pull Request as a Show or Ask type of change

on:
pull_request:
types: [labeled]

env:
SLACK_CHANNEL_ID: C018Q6WBJ85

jobs:
notify:
if: ${{ github.event.label.name == 'show' || github.event.label.name == 'ask' }}
runs-on: small
steps:
- name: Notify
uses: slackapi/slack-github-action@v1
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ env.SLACK_CHANNEL_ID }}
payload: |
{
"text": ":sui: :${{ github.event.label.name }}: _*${{ github.event.pull_request.title }}*_",
"attachments": [
{
"color": "${{ github.event.label.name == 'show' && '#AFE1AF' || '#C9CC3F'}} ",
"blocks": [
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":point_right: ${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}\n :github: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>"
}
]
}
]
}
]
}
50 changes: 50 additions & 0 deletions .github/workflows/notify-ship.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Notify on Slack about a push to master as a Ship type of change

on:
push:
branches:
- 'master'

env:
SLACK_CHANNEL_ID: C018Q6WBJ85

jobs:
notify:
if: ${{ github.actor != 'srv-scms-git-enb' }}
runs-on: small
steps:
- name: Checkout Commit
uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Get Head Commit Message
id: get_head_commit_message
run: |
echo "HEAD_COMMIT_MESSAGE=$(git show -s --format=%s)" >> "$GITHUB_ENV"
- name: Notify
if: ${{ contains(env.HEAD_COMMIT_MESSAGE, 'Merge pull request') == false && contains(env.HEAD_COMMIT_MESSAGE, 'skip notify') == false }}
uses: slackapi/slack-github-action@v1
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ env.SLACK_CHANNEL_ID }}
payload: |
{
"text": ":sui: :ship: _*${{ env.HEAD_COMMIT_MESSAGE }}*_",
"attachments": [
{
"color": "#AFE1AF",
"blocks": [
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": ":point_right: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}\n :github: <${{ github.server_url }}/${{ github.actor }}|${{ github.actor }}>"
}
]
}
]
}
]
}

0 comments on commit ab104d1

Please sign in to comment.