Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
hello:
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@master
- uses: shpingalet007/pull-request-comment-trigger@master
id: check
with:
trigger: '#hello'
Expand All @@ -19,7 +19,7 @@ jobs:
eyes:
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@master
- uses: shpingalet007/pull-request-comment-trigger@master
id: check
with:
trigger: '#look'
Expand All @@ -32,12 +32,14 @@ jobs:
rocket:
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@master
- uses: shpingalet007/pull-request-comment-trigger@master
id: check
with:
trigger: '#deploy'
trigger: '/version set ** **'
reaction: rocket
allow_arguments: true
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- run: 'echo Found it!'
if: steps.check.outputs.triggered == 'true'
- run: |
echo "TRIGGERED ${{ steps.check.outputs.arguments }}"
if: steps.check.outputs.triggered == 'true'
55 changes: 2 additions & 53 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,2 @@
# Pull Request Comment Trigger

Look for a "trigger word" in a pull-request description or comment, so that later steps can know whether or not to run.

<!-- TODO release workflow-preprocessor This is most useful in tandem with [workflow-preprocessor], so that you don't have to be writing a ton of `if`s all down the line. -->

## Example usage in a workflow

Your workflow needs to listen to the following events:
```
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
```

And then you can use the action in your jobs like this:

```
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: khan/pull-request-comment-trigger@v1.1.0
id: check
with:
trigger: '@deploy'
reaction: rocket
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
- run: 'echo Found it!'
if: steps.check.outputs.triggered == 'true'
```

Reaction must be one of the reactions here: https://developer.github.com/v3/reactions/#reaction-types
And if you specify a reaction, you have to provide the `GITHUB_TOKEN` env vbl.

## Inputs

| Input | Required? | Description |
| ----- | --------- | ----------- |
| trigger | Yes | The string to look for in pull-request descriptions and comments. For example "#build/android". |
| prefix_only | No (default 'false') | If 'true', the trigger must match the start of the comment. |
| reaction | No (default '') | If set, the specified emoji "reaction" is put on the comment to indicate that the trigger was detected. For example, "rocket". |


## Outputs

| Output | Description |
| ------ | ----------- |
| triggered | 'true' or 'false' depending on if the trigger phrase was found. |
| comment_body | The comment body. |
## Implementation of arguments for Khan/pull-request-comment-trigger
Discussion on [issue #33](https://github.com/Khan/pull-request-comment-trigger/issues/33)
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: If 'true', the trigger must match the start of the comment.
required: false
default: "false"
allow_arguments:
description: If 'true', the trigger can have arguments. Can be passed via "**".
required: false
default: "false"
outputs:
triggered:
description: the string 'true' if the trigger was found, otherwise the string 'false'
Expand Down
Loading