Automatic Creation of PRs from Issues
Haven't thought it through completely yet. High level tho:
- Use GitHub Actions to detect whenever an issue is created or edited
- Use a Node.js/JavaScript script that runs when that action is triggered to get the issue contents
- Parse each section of the issue text to get the relevant details (this might require some changes to the issue templates) (ie. URLs, list it should be added to, if it's an add or remove request)
- Modify the files
- Open a PR
Most of the logic for steps 1 and 2 (and partly 3) can be found in a similar PR I did for Dynamoose: https://github.com/dynamoose/dynamoose/pull/1154.
Outstanding issues:
- Updating PRs when someone edits an issue is difficult (a solution to this might be to require a simple comment like
@blocklistprojectci PR thisand then it'll generate a PR)
Overall with GitHub Actions this should be pretty easy tho.
I think we can use https://docs.github.com/en/rest/reference/pulls (or an interface for it, i.e. https://github.com/actions/github-script) plus the opened or maybe edited events for issues
@iam-py-test Yes. The edited event is complicated tho. Not saying it's impossible. But it adds another layer of complexity. I mean maybe if we close the PR and regenerate it from scratch it'd be easier. But getting a diff and trying to update an existing PR automatically, is more complicated.
You should, if https://github.com/blocklistproject/Lists/issues/438 == True, add a validating for IP addresses as that isn't supported by hosts files.
@spirillen Sounds completely off topic and unrelated to this issue.
You should, if #438 == True, add a validating for IP addresses as that isn't supported by hosts files.
@spirillen Sounds completely off topic and unrelated to this issue.
Oh yeah, it should have been in another issue with the linter... (Which I can't find now :unamused: ) my bad
My suggestion: https://github.com/marketplace/actions/closes-issues-related-to-a-merged-pull-request I could test it in my fork if you are generally agreeing that an GH action would be fine for you…
@thomasmerz Sorry. Don't support this. GitHub already has that built in if you include the correct text in the pull request body. No need to add additional complexity here.
Ah, ok, I wondered on some other repos how it comes that issues seem to be autoclosed when PR was merged and I didn't find any GH action. I think you mean this?
That's really nice and could save all contributors and collaborateurs much time/effort 👍🏻
@thomasmerz Yep! That is what I'm referring to 😃