Skip to content

testing slack notification #193

testing slack notification

testing slack notification #193

Workflow file for this run

# This workflow is an example of a combination of automatic and manual release.
# The triggers are:
# - Push
# - Workflow Dispatch
#
# This workflow uses the `if` conditions to control when the CI runs versus when
# a release is also created.
#
# The CI runs when pull requests are created and also when code is merged into
# main, i.e. push events to main.
#
# Lastly, it will trigger from manually workflow dispatches.
name: CI and Release
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
version:
# Friendly description to be shown in the UI instead of 'name'
description: "Semver type of new version (major / minor / patch)"
# Input has to be provided for the workflow to run
required: true
type: choice
options:
- patch
- minor
- major
jobs:
# Example for docker file linting
# hadolint:
# uses: celestiaorg/.github/.github/workflows/reusable_dockerfile_lint.yml@master
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yamllint
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/markdown-lint
# Make a release if
# - there were changes and this is a scheduled job
# - This is a manually trigger job, i.e. workflow_dispatch
release:
needs: [yamllint, markdown-lint]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
permissions: "write-all"
steps:
- uses: actions/checkout@v3
- name: Version Release
uses: ./.github/actions/version-release
with:
github-token: ${{secrets.GITHUB_TOKEN}}
version-bump: ${{inputs.version}}
# Example for docker builds
# docker:
# needs: release
# name: Build and Push Docker image to Docker Hub
# runs-on: ubuntu-latest
# steps:
# - name: Check out the repo
# uses: actions/checkout@v3
# - uses: celestiaorg/.github/.github/actions/docker-publish@master
# with:
# docker_username: ${{ secrets.DOCKER_USERNAME}}
# docker_password: ${{ secrets.DOCKER_PASSWORD}}
# docker_repository: <update>
# semver_version: ${{ needs.release.outputs.new_version }}
notify-slack-on-failure:
needs: [yamllint, markdown-lint]
runs-on: ubuntu-latest
steps:
- name: Notify Slack On Failure
uses: ravsamhq/notify-slack-action@v2
if: always()
# if: always() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
with:
status: ${{ job.status }}
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_RELEASE_CHANNEL }}