Lists icon indicating copy to clipboard operation
Lists copied to clipboard

Automatic Creation of PRs from Issues

Open fishcharlie opened this issue 4 years ago • 8 comments

Haven't thought it through completely yet. High level tho:

  1. Use GitHub Actions to detect whenever an issue is created or edited
  2. Use a Node.js/JavaScript script that runs when that action is triggered to get the issue contents
  3. 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)
  4. Modify the files
  5. 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 this and then it'll generate a PR)

Overall with GitHub Actions this should be pretty easy tho.

fishcharlie avatar Jul 07 '21 22:07 fishcharlie

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 avatar Jul 07 '21 22:07 iam-py-test

@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.

fishcharlie avatar Jul 16 '21 20:07 fishcharlie

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.

fishcharlie avatar Aug 02 '21 09:08 fishcharlie

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

spirillen avatar Aug 02 '21 11:08 spirillen

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 avatar Feb 21 '22 08:02 thomasmerz

@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.

fishcharlie avatar Feb 21 '22 15:02 fishcharlie

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 avatar Feb 21 '22 16:02 thomasmerz

@thomasmerz Yep! That is what I'm referring to 😃

fishcharlie avatar Feb 21 '22 16:02 fishcharlie