Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/machine-learning-apps/actions-chatops
Actions That Enables ChatOps In a PR Through a GitHub App
https://github.com/machine-learning-apps/actions-chatops
Last synced: about 1 month ago
JSON representation
Actions That Enables ChatOps In a PR Through a GitHub App
- Host: GitHub
- URL: https://github.com/machine-learning-apps/actions-chatops
- Owner: machine-learning-apps
- License: mit
- Archived: true
- Created: 2019-10-03T13:58:55.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T03:13:44.000Z (about 2 years ago)
- Last Synced: 2024-10-07T18:32:24.846Z (2 months ago)
- Language: Python
- Homepage:
- Size: 101 KB
- Stars: 74
- Watchers: 5
- Forks: 11
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - ChatOps for PRs
- fucking-awesome-actions - ChatOps for PRs
- awesome-workflows - ChatOps for PRs
README
![Actions Status](https://github.com/machine-learning-apps/actions-chatops/workflows/Tests/badge.svg)
# 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](https://www.pagerduty.com/blog/what-is-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
```yaml
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](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) 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