https://github.com/anjakammer/brigade-pr-comment
Brigade job for commenting on a GitHub pull request
https://github.com/anjakammer/brigade-pr-comment
brigade github-bot
Last synced: about 1 year ago
JSON representation
Brigade job for commenting on a GitHub pull request
- Host: GitHub
- URL: https://github.com/anjakammer/brigade-pr-comment
- Owner: anjakammer
- License: mit
- Created: 2018-11-11T19:39:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-28T10:56:06.000Z (about 3 years ago)
- Last Synced: 2023-05-28T12:15:35.403Z (about 3 years ago)
- Topics: brigade, github-bot
- Language: JavaScript
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://GitHub.com/Naereen/StrapDown.js/graphs/commit-activity)
### Comments on a pull request or issue
GitHub App Permissions:
* read&write Pull Requests
or
* read&write issues
## Required Environment Variables
| Key | Description |
| ----------------|-----------------------------------------------------------|
| `APP_NAME` | Developer or App Name |
| `WAIT_MS` | Wait until sending the comment (default: 120000) |
| `COMMENT` | Comment to send |
| `COMMENTS_URL` | https: //api.github.com/repos/[org]/[repo]/pulls/[id] |
| `TOKEN` | jwt token to do api calls |
## Usage
With the [Brigade-GitHub-App](https://github.com/Azure/brigade-github-app):
```javascript
const payload = JSON.parse(e.payload)
const previewUrl = `${secrets.hostName}/preview/${imageTag}`
const prCommenter = new Job('pr-comment', 'anjakammer/brigade-pr-comment')
prCommenter.env = {
APP_NAME: 'your-GitHub-App',
WAIT_MS: '0', // default is 2 minutes
COMMENT: `Preview Environment is set up: [https://${previewUrl}](${previewUrl})`,
COMMENTS_URL: payload.body.pull_request.comments_url, // depends on webhook payload
TOKEN: payload.token
}
prCommenter.run()
```
## TODO
- [ ] automagically fetch `comments_url` from every webhook payload possible.
This way, only passing the brigade-payload string is needed. `comments_url` and `token` can be fetched from it.