Compare commits
5 Commits
b68c3dab33
...
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| f907a64f08 | |||
| 3b4496864b | |||
| eb4666c3df | |||
| def91e35d3 | |||
| 4794c6be26 |
@@ -1,5 +1,11 @@
|
||||
### Changelog
|
||||
|
||||
#### [v1.0.1](https://git.w33ble.com/w33ble/gh-action-bot/compare/v1.0.0...v1.0.1) (22 October 2018)
|
||||
- feat: add a force retest script [`def91e3`](https://git.w33ble.com/w33ble/gh-action-bot/commit/def91e35d3c8028b7f78772049b0e93c3c8d677e)
|
||||
- fix: add error handling code [`3b44968`](https://git.w33ble.com/w33ble/gh-action-bot/commit/3b4496864b0e9bd248e6d4ea12f2608dd41c0374)
|
||||
- docs: add info about force script [`eb4666c`](https://git.w33ble.com/w33ble/gh-action-bot/commit/eb4666c3df312a9b5d8eb8ff5cf58027d794b417)
|
||||
- docs: add token info to readme [`4794c6b`](https://git.w33ble.com/w33ble/gh-action-bot/commit/4794c6be2673402d5a76d8c61974ba3f9c936977)
|
||||
|
||||
### [v1.0.0](https://git.w33ble.com/w33ble/gh-action-bot/compare/v0.1.0...v1.0.0) (18 October 2018)
|
||||
- feat: allow filtering by pr author [`68cccb7`](https://git.w33ble.com/w33ble/gh-action-bot/commit/68cccb72a9801c502003c7b913844fc01721a6e3)
|
||||
|
||||
|
||||
@@ -7,10 +7,15 @@ Action bot for Github. Checks a repo's event stream and leaves a ghost comment w
|
||||
|
||||
## Usage
|
||||
|
||||
`node . owner/repo`
|
||||
`yarn start owner/repo`: watch the event stream and handle matches
|
||||
|
||||
`yarn run force owner/repo pr_number`: force a comment on a specific pr, by number
|
||||
|
||||
You'll need to set some environment flags. Check `sample-env` for what is available, and you can copy the file to `.env` in the root and add your settings there as well.
|
||||
|
||||
### Personal Access Token
|
||||
|
||||
You will need to provide a Github [Personal Access Token](https://github.com/settings/tokens/new). It will need `write:org` access in order to create comments.
|
||||
|
||||
#### License
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gh-action-bot",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"private": true,
|
||||
"description": "Action bot for Github",
|
||||
"main": "index",
|
||||
@@ -9,7 +9,8 @@
|
||||
"lint": "eslint \"*.{js,mjs}\" \"src/**/*.{js,mjs}\"",
|
||||
"precommit": "lint-staged",
|
||||
"version": "auto-changelog -p && auto-authors && git add CHANGELOG.md AUTHORS.md",
|
||||
"start": "node ."
|
||||
"start": "node .",
|
||||
"force": "node -r esm src/force.mjs"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
20
src/force.mjs
Normal file
20
src/force.mjs
Normal file
@@ -0,0 +1,20 @@
|
||||
import dotenv from 'dotenv';
|
||||
import createRepo from './lib/create_repo.mjs';
|
||||
import { createComment, deleteComment } from './lib/comments.mjs';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
async function forceRetest() {
|
||||
const [ownerRepo, prNumber] = process.argv.splice(2);
|
||||
const { PULL_RETEST_BODY } = process.env;
|
||||
|
||||
if (!ownerRepo || !prNumber) {
|
||||
throw new Error('You must specify an owner/repo combo and a pull request number');
|
||||
}
|
||||
|
||||
const repo = createRepo(ownerRepo);
|
||||
const comment = await createComment(repo, prNumber, PULL_RETEST_BODY);
|
||||
await deleteComment(repo, comment.id);
|
||||
}
|
||||
|
||||
forceRetest().catch(err => console.error(err));
|
||||
@@ -10,7 +10,7 @@ import History from './lib/history.mjs';
|
||||
// load env vars from .env file
|
||||
dotenv.config();
|
||||
|
||||
export default async function() {
|
||||
async function ghActionBot() {
|
||||
// parse repo name from cli and create repo instance
|
||||
const repo = createRepo(process.argv.splice(2)[0]);
|
||||
const {
|
||||
@@ -64,19 +64,11 @@ export default async function() {
|
||||
await deleteComment(repo, comment.id);
|
||||
})
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
TODO:
|
||||
|
||||
- [x] keep track of seen comment ids, only process new ones
|
||||
- [x] check the pr's status and only retest if no longer "Pending"
|
||||
- [x] add a retest comment
|
||||
- POST /repos/:owner/:repo/issues/:number/comments
|
||||
- [x] delete the retest comment
|
||||
- [ ] delete the build comment
|
||||
- [ ] delete ALL build failure comments
|
||||
- DELETE /repos/:owner/:repo/issues/comments/:comment_id
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
export default function() {
|
||||
return ghActionBot().catch(err => {
|
||||
console.error(err);
|
||||
return process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user