https://github.com/lowply/comment-command
Comment Command
https://github.com/lowply/comment-command
Last synced: 3 months ago
JSON representation
Comment Command
- Host: GitHub
- URL: https://github.com/lowply/comment-command
- Owner: lowply
- Created: 2020-08-29T14:29:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-30T16:02:55.000Z (almost 5 years ago)
- Last Synced: 2025-03-15T07:07:17.650Z (3 months ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Comment Command
When used as a step in a workflow, this GitHub Action parses the issue comment and returns the first word as the command and the second and third words as the arguments. The command should begin with `/`, and the issue comment should belong to a pull request, not an issue.
Works best for deployments using GitHub Actions.
## Example
```
/deploy production
```Will output:
- command: deploy
- arguments: productionIt only takes the first two words as the arguments. For example:
```
/deploy production canary test example one two
```Will output:
- command: deploy
- arguments: production canary## Usage
Make sure you have the following format in your workflow file:
```
on:
issue_comment:
types:
- created
jobs:
[job_name]:
runs-on: [your-environment]
if: (startsWith(github.event.comment.body, '/') && github.event.issue.pull_request)
steps:
- name: Comment Command
id: comment-command
uses: lowply/comment-command@v1
```In the following step, you can use the `command` and `arguments` outputs:
```
- name: Checkout PR head
uses: actions/checkout@v2
if: contains(steps.comment-command.outputs.command, 'deploy')
with:
ref: [ref]
```Visit https://github.com/lowply/comment-command for more info.