Skip to content

steplix/cicd-notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cicd-notify

Github action to send notifications via slack with different templates.
This action call the action act10ns/[email protected].

Configuration

Environment Variables (input)

SLACK_WEBHOOK_URL (required)

Create a Slack Webhook URL using either the Incoming Webhooks App (preferred) or by attaching an incoming webhook to an existing Slack App (beware, channel override not possible when using a Slack App):

env:
    SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

Input Parameters (with)

template (required)

Pass the name of the to use, available templates:

  1. pr
  2. push
  3. release
with:
    template: push

status (required)

The status must be defined. It can either be the current job status using:

with:
    status: ${{ job.status }}

or a hardcoded custom status such as "starting" or "in progress":

with:
    status: in progress

slack_webhook_url (optional)

Only required if the SLACK_WEBHOOK_URL environment variable is not set.

with:
    slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}

steps (optional)

The individual status of job steps can be included in the Slack message using:

with:
    steps: ${{ steps }}

Note: Only steps that have a "step id" will be reported on. See example below.

channel (optional)

To override the channel or to send the Slack message to an individual use:

with:
    channel: '#workflows'

logo_url (optional)

Logo displayed in slack message.

with:
    logo_url: 'https://s3-us-west-2.amazonaws.com/slack-files2/bot_icons/2023-01-09/4618522117268_48.png'

Default logo is: Default logo

Template requirements

pr template

The pr template require 2 environment variables (env) PR_URL AND PR_NUMBER.

The action pull-request@v2 create an new PR and output the url and number.

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: create-pr
        id: pr
        uses: repo-sync/pull-request@v2
        with:
          destination_branch: testing
          github_token: ${{ secrets.GITHUB_TOKEN }}

      - name: slack - GitHub Actions Slack integration
        uses: steplix/[email protected]
        with:
          template: pr
          channel: '#back-test-pipes'
          status: ${{ job.status }}
          steps: ${{ toJson(steps) }}
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          PR_URL: ${{ steps.pr.outputs.pr_url }}
          PR_NUMBER: ${{ steps.pr.outputs.pr_number }}

release template

The release template require NEW_TAG environment variables (env).

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - name: slack - GitHub Actions Slack integration
        uses: steplix/[email protected]
        with:
          template: release
          channel: '#back-test-pipes'
          status: ${{ job.status }}
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          NEW_TAG: '1.0.1'

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •