Git Product home page Git Product logo

action's Introduction

Send notifications from your GitHub workflows

Use this GitHub action to inform yourself or your team about activity in your repository. Think of use cases like:

  • sending your team a notification when an issue is labelled critical
  • sending devops a notification when a deployment fails
  • sending yourself a notification when a new pull request is opened
  • sending the contributor a notification when their pull request is merged
  • sending a Slack message to your announcements channel on a new release

Usage

name: 'Notify Me'
on: pull_request

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Send Notification
        uses: magicbell/action/notify@v1
        with:
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }} 
          recipients: '[email protected], [email protected]'
          title: 'Activity on pull ${{ github.event.number }}!'

Inputs

The notify action accepts a number of options. The following options are required for all calls:

  • api-key String

    Your project api key which can be found on the MagicBell Dashboard. This key is required for all calls.

  • api-secret String

    Your project api secret which can be found on the MagicBell Dashboard. This key is required for project oriented endpoints.

  • title String

    The title of the notification.

  • recipients String

    A comma (,) separated list of recipients, currently limited to email addresses.

The following options are optional:

  • content String

    The content of the notification.

  • category String

    The category of the notification. This can be used to group notifications together.

  • topic String

    The topic of the notification. This can be used to thread notifications.

  • action-url String

    The URL to which the notification will link to.

  • custom-attributes JSON

    A JSON string of custom attributes to be attached to the notification. Tip; use the GitHub ${{ toJson(...) }} helper.

  • overrides JSON

    A JSON string of delivery overrides to be attached to the notification. Tip; use the GitHub ${{ toJson(...) }} helper.

Recipes

Sending the contributor a notification on push

name: 'Notify Contributor'

on: push

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Send Notification
        uses: magicbell/action/notify@v1
        with: # api-key, api-secret, recipients and title are required.
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }}
          recipients: '${{ github.event.pusher.email }}'
          title: 'Thanks for pushing!'

Sending a notification on pull request activity

name: 'Notify on pull request'

on: pull_request

jobs:
  notify:
    runs-on: ubuntu-latest
    steps:
      - name: Send Notification
        uses: magicbell/action/notify@v1
        with: # api-key, api-secret, recipients and title are required.
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }} 
          recipients: '${{ secrets.MY_EMAIL }}'
          title: 'Activity on pull ${{ github.event.number }}!'
          action-url: 'https://github.com/${{ github.repository }}/pulls/${{ github.event.number }}'

Sending a notification when publishing a release

name: On Release

on:
  release:
    types: [published]

jobs:
  notify:
    name: Send Release Notes
    runs-on: ubuntu-latest

    steps:
      - name: Send Notification
        uses: magicbell/action/notify@v1
        with:
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }}
          recipients: ${{ secrets.MY_EMAIL }}
          title: 'Just Released: ${{ github.event.release.name }}!'
          content: ${{ github.event.release.body }}
          action-url: ${{ github.event.release.html_url }}

Sending a notification when an issue gets created

name: On Issue Created

on:
  issues:
    types: [opened]

jobs:
  notify-me:
    runs-on: ubuntu-latest
    steps:
      - name: Send Notification
        uses: magicbell/action/notify@main
        with:
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }}
          recipients: '${{ secrets.MY_EMAIL }}'
          title: 'Issue created: ${{ github.event.issue.number }} - ${{ github.event.issue.title }}'
          content: ${{ github.event.issue.body }}
          action-url: ${{ github.event.issue.html_url }}
          custom-attributes: ${{ toJSON(github.event.issue) }}

Sending a notification when an issue gets labelled

name: On Issue Labeled Critical

on:
  issues:
    types: [labeled]

jobs:
  notify:
    if: github.event.label.name == 'critical'
    runs-on: ubuntu-latest
    
    steps:
      - name: Send Notification
        uses: magicbell/action/notify@v1
        with:
          api-key: ${{ secrets.MAGICBELL_API_KEY }}
          api-secret: ${{ secrets.MAGICBELL_API_SECRET }}
          recipients: ${{ secrets.MY_EMAIL }}
          title: 'Issue declared critical: ${{ github.event.issue.number }} - ${{ github.event.issue.title }}'

action's People

Contributors

smeijer avatar

Watchers

 avatar  avatar

action's Issues

Reorganize the repo to be publishable to the marketplace

Thanks @smeijer for the action! Can we reorganize the repo to be able to publish the action to the marketplace? The instructions are at https://docs.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action.

TLDR;

When you plan to publish your action to GitHub Marketplace, you'll need to ensure that the repository only includes the metadata file, code, and files necessary for the action. Creating a single repository for the action allows you to tag, release, and package the code in a single unit. GitHub also uses the action's metadata on your GitHub Marketplace page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.