Support Creating PRs to PRs to Automatically Fix Issues
See original GitHub issueHi there! We’ve been using dangerjs for a little while and it has really helped automate our code review process. It’s an awesome tool that I think every serious project should use.
We’d like to take it further, by automatically opening PRs to fix some of the issues that danger detects. As a simple example, danger could see that there are eslint errors, open a new PR to that branch which ran eslint --fix
and, if that new PR has no issues, maybe even auto merge it! There all kinds of crazy things we could do, like automatically generating some basic test suites if coverage is too low (with a separate danger warning telling you to fill them in), automatically bumping package.json verisons, and generally just being an entry level developer.
All of this is really just predicated on having a clear API to create a new PR to the current one and committing whatever changes danger has made. Maybe it’s already a thing, but I couldn’t find it in the danger docs - and if it’s not, the github API for creating PRs seems relatively straightforward.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10 (7 by maintainers)
Top GitHub Comments
My focus for the next few months is getting danger to 1.0, which at this point is mainly plugins and documentation ( https://github.com/danger/danger-js/issues/225 ) -
I think it’s an interesting idea, which is worth supporting in the long run, as long as it only works through the Github API, rather than making changes at the file system level and tries pushing those up.
I know this sucks a bit (can’t do
yarn eslint */**.js
, but most things like ESLint/tslint/prettier provide a way to use their API in-memory) so it shouldn’t be a blockerThere’s two interesting points here:
Without an in-depth look, I’d imagine that it would feel something like a transactional closure:
This would need to use the GitHub API to create a branch and then modify that branch, if it can be done in one commit - great, off-hand I’m not sure if it can.
There are two GitHub APIs inside danger my homebrew one and the npm github module (which is exposed to end-users. It shouldn’t matter which one use, but the node-module is probably the better choice.
This is where the
danger.github
object is set up.but that’s the API to use