mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-04 22:21:36 +09:00
- more compact - notifies pushes & merged/closed PRs - only show one line of the PR or commit message
35 lines
1.4 KiB
YAML
35 lines
1.4 KiB
YAML
name: Slack Push Notifier
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
types: [closed]
|
|
branches: [master]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
notify_slack_push:
|
|
name: Notify Slack on pushes
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: String manipulation
|
|
run: echo "COMMIT_ONELINER=${{ github.event.head_commit.message }}${{ github.event.pull_request.title }}"|grep -v '^$'|head -1 >> $GITHUB_ENV
|
|
|
|
- name: It is a merged pull request
|
|
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.merged == true }}
|
|
uses: abinoda/slack-action@master
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
with:
|
|
args: '{\"channel\":\"${{ secrets.SLACK_CHANNEL_ID }}\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" > --> *New PR merged:* <${{ github.event.pull_request.html_url }}|${{ env.COMMIT_ONELINER }}> (<${{ github.event.pull_request.html_url }}|PR>)\n\"}}]}'
|
|
|
|
- name: It is a direct push
|
|
if: ${{ github.event_name == 'push' }}
|
|
uses: abinoda/slack-action@master
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
with:
|
|
args: '{\"channel\":\"${{ secrets.SLACK_CHANNEL_ID }}\",\"blocks\":[{\"type\":\"section\",\"text\":{\"type\":\"mrkdwn\",\"text\":\" > --> *New Commit:* <${{ github.event.head_commit.url }}|${{ env.COMMIT_ONELINER }}>\n\"}}]}'
|