GithubHelp home page GithubHelp logo

machine-learning-apps / actions-chatops Goto Github PK

View Code? Open in Web Editor NEW
74.0 5.0 11.0 103 KB

Actions That Enables ChatOps In a PR Through a GitHub App

License: MIT License

Python 70.37% Jupyter Notebook 22.32% Dockerfile 2.12% Shell 5.19%

actions-chatops's Introduction

Actions Status

Trigger Actions With ChatOps on Pull Requests

This action helps you trigger downstream actions with a custom command made via a comment in a pull request, otherwise known as ChatOps.

Optionally, you may provide credentials to authenticate as a GitHub App and label an issue once a trigger phrase is detected. Having another app other than the GitHub Action apply a label allows you to create a label event to trigger downstream Actions (since an Action cannot create events that trigger other Actions).

Example Usage

name: Demo
on: [issue_comment]

jobs:
  label-pr:
    runs-on: ubuntu-latest
    steps:
      - name: listen for PR Comments
        uses: machine-learning-apps/actions-chatops@master
        with:
          APP_PEM: ${{ secrets.APP_PEM }}
          APP_ID: ${{ secrets.APP_ID }}
          TRIGGER_PHRASE: "/test-trigger-comment"
          INDICATOR_LABEL: "test-label"
        env: # you must supply GITHUB_TOKEN
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        id: prcomm
        # This step clones the branch of the PR associated with the triggering phrase, but only if it is triggered.
      - name: clone branch of PR
        if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
        uses: actions/checkout@master
        with:
          ref: ${{ steps.prcomm.outputs.SHA }}

        # This step is a toy example that illustrates how you can use outputs from the pr-command action
      - name: print variables
        if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
        run: echo "${USERNAME} made a triggering comment on PR# ${PR_NUMBER} for ${BRANCH_NAME}"
        env: 
          BRANCH_NAME: ${{ steps.prcomm.outputs.BRANCH_NAME }}
          PR_NUMBER: ${{ steps.prcomm.outputs.PULL_REQUEST_NUMBER }}
          USERNAME: ${{ steps.prcomm.outputs.COMMENTER_USERNAME }}

Mandatory Inputs

  • TRIGGER_PHRASE: this is the phrase in a PR comment that you want to trigger downstream Actions. Example - "/deploy-app-test"

Optional Inputs

If one of the below three arguments are provided, all three must be present.

  • INDICATOR_LABEL: label that will be added to the PR if a triggering comment is detected. This is used to trigger downstream Actions with the right context of the PR.

  • APP_PEM: description: string version of your PEM file used to authenticate as a GitHub App. This is required if the input INDICATOR_LABEL is supplied.

  • APP_ID:your GitHub App ID. This is required if the input INDICATOR_LABEL is supplied.

  • TEST_EVENT_PATH: An alternate place to fetch the payload for testing and debugging when making changes to this Action. This is set to the system environment variable $GITHUB_EVENT_PATH by default.

Outputs

  • TRAILING_LINE: the text that immediately follows the triggering phrase that is on the same line. For example, "/trigger-phrase foo bar\n next line" will emit the value "foo bar" This is intended to be used as arguments for downstream actions.

  • TRAILING_TOKEN: this is the next token that immediately follows the triggering phrase that is on the same line. For example, "/trigger-phrase foo bar" will emit the value "foo". This is intended to be used as arguments for downstream actions.

  • PULL_REQUEST_NUMBER: the number of the pull request

  • COMMENTER_USERNAME: The GitHub username of the person that made the triggering comment in the PR.

  • BRANCH_NAME: The name of the branch corresponding to the PR.

  • SHA: The SHA of the branch on the PR at the time the triggering comment was made.

  • BOOL_TRIGGERED: true or false depending on if the trigger phrase was detected and this is a pull request.

  • APP_INSTALLATION_TOKEN: The installation access token for the GitHub App corresponding to the current repository. This is only retrieved if the APP_PEM and APP_ID inputs are supplied.

Keywords

MLOps, Machine Learning, Data Science

actions-chatops's People

Contributors

aweris avatar dependabot[bot] avatar hamelsmu avatar jsoref avatar nikenano avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

actions-chatops's Issues

Feature: Emoji reaction

First of all: Thanks you for developing this awesome action! It helped me a lot.

I would like to request the feature, that you can react with an emoji to the comment instead of just having an option to label the PR.
The Dependabot Bot does this, when you trigger it using a PR Comment, and https://github.com/Khan/pull-request-comment-trigger also supports it.

image

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.