You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 9, 2022. It is now read-only.
# Trigger Actions With ChatOps via PR Labels or Deployements
4
4
5
-
This action helps you trigger downstream actions with a custom command made via a comment in a pull request, otherwhise known as [ChatOps](https://www.pagerduty.com/blog/what-is-chatops/). This Action is similar to [this chatops action](https://github.com/machine-learning-apps/actions-chatops), except that this Action can defer to GitHub App to (1) Make labels on a PR or (2) Create a [Deployment](https://developer.github.com/v3/repos/deployments/#create-a-deployment). The reasons you might want to do this are the following:
6
5
7
-
- By deferring to a GitHub App to create a pull request label or a deployment event, you can trigger a downstream GitHub Action that runs in the context of a pull request. The reason for using a GitHub App is Actions cannot trigger other Actions.
8
-
- It can be important to run in the context of a pull request as that is the only way you will see [Check Runs](https://developer.github.com/v3/checks/runs/) for your pull request, so you can monitor the status of your workflows.
9
-
- Note that comments on PRs [triggers Actions workflows on the default branch](https://help.github.com/en/articles/events-that-trigger-workflows#issue-comment-event-issue_comment) which is not desireable for ChatOps most of the time. This Action resolves this issue by piggybacking on a GitHub app to create an event that will trigger Actions workflows on the pull request's branch instead.
10
-
- This can prevent you from accidentally executing the chatops command twice as the label event will not fire if the PR is already labeled or the deployment has already been created.
6
+
This action helps you trigger downstream actions with a custom command made via a comment in a pull request, otherwhise known as [ChatOps](https://www.pagerduty.com/blog/what-is-chatops/).
11
7
12
-
Therefore, one of the required inputs is the secret key `APP_PEM` for authenticating as a GitHub App which has the following permissions:
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).
A demonstration of this in action can be found on [this PR](https://github.com/machine-learning-apps/actions-chatops-workaround/pull/2).
48
+
A demonstration of this in action can be found on [this PR](https://github.com/machine-learning-apps/actions-chatops/pull/2).
38
49
39
50
## Mandatory Inputs
40
51
@@ -52,9 +63,27 @@ A demonstration of this in action can be found on [this PR](https://github.com/m
52
63
53
64
- `INDICATOR_LABEL`:
54
65
- description: label that wil 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.
55
-
- required: true
66
+
- required: false
67
+
- default: ""
56
68
57
69
- `TEST_EVENT_PATH`:
58
70
- description: An alternate place to fetch the payload for testing and debugging when making changes to this Action. This is set to they system environment variable $GITHUB_EVENT_PATH by default.
59
71
- require: false
60
-
default: ""
72
+
- default: ""
73
+
74
+
75
+
## Outputs
76
+
77
+
- `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.
78
+
79
+
- `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.
80
+
81
+
- `PULL_REQUEST_NUMBER`: the number of the pull request
82
+
83
+
- `COMMENTER_USERNAME`: The GitHub username of the person that made the triggering comment in the PR.
84
+
85
+
- `BRANCH_NAME`: The name of the branch corresponding to the PR.
86
+
87
+
- `SHA`: The SHA of the branch on the PR at the time the triggering comment was made.
88
+
89
+
- `BOOL_TRIGGERED`: true or false depending on if the trigger phrase was detected and this is a pull request.
Copy file name to clipboardExpand all lines: action.yml
+21-5Lines changed: 21 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
name: 'ChatOps Via PR Labels'
2
-
description: Trigger PR labels with chatops and a GitHub App, which is a work-around to trigger downstream Actions with the right context.
1
+
name: 'ChatOps For Actions'
2
+
description: Listen for special comments, or chatops commands in the comments of a PR.
3
3
author: Hamel Husain
4
4
inputs:
5
5
APP_PEM:
6
6
description: string version of your PEM file used to authenticate as a GitHub App
7
-
required: true
7
+
required: false
8
8
APP_ID:
9
9
description: you GITHUB App ID.
10
10
required: true
@@ -13,13 +13,29 @@ inputs:
13
13
required: true
14
14
INDICATOR_LABEL:
15
15
description: label that wil 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.
16
-
required: true
16
+
required: false
17
+
default: ""
17
18
TEST_EVENT_PATH:
18
19
description: An alternate place to fetch the payload for testing and debugging when making changes to this Action. This is set to they system environment variable $GITHUB_EVENT_PATH by default.
19
20
require: false
20
21
default: ""
22
+
outputs:
23
+
TRAILING_LINE:
24
+
description: 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.
25
+
TRAILING_TOKEN:
26
+
description: 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.
27
+
BOOL_TRIGGERED:
28
+
description: true or false depending on if the trigger phrase was detected and this is a pull request.
29
+
PULL_REQUEST_NUMBER:
30
+
description: the number of the pull request
31
+
COMMENTER_USERNAME:
32
+
description: The GitHub username of the person that made the triggering comment in the PR.
33
+
BRANCH_NAME:
34
+
description: The name of the branch corresponding to the PR.
35
+
SHA:
36
+
description: The SHA of the branch on the PR at the time the triggering comment was made.
0 commit comments