Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: A script to revert changes made via GitHub API #1379

Open
2 tasks done
danvk opened this issue Mar 9, 2024 · 5 comments
Open
2 tasks done

🚀 Feature: A script to revert changes made via GitHub API #1379

danvk opened this issue Mar 9, 2024 · 5 comments
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request

Comments

@danvk
Copy link
Contributor

danvk commented Mar 9, 2024

Bug Report Checklist

Overview

I ran npx create-typescript-app on https://github.com/danvk/literate-ts and created a PR, but I didn't merge it. I was surprised to see that changes had been made to my repo via the GitHub API (branch protection rules) independently of that PR.

I'll manually revert them, but it would be nice if these changes could be made / reverted more easily via a script.

Additional Info

Would likely be fixed by #1309. Feel free to close this as a dupe if that's a feasible solution.

@danvk danvk added the type: feature New enhancement or request label Mar 9, 2024
@JoshuaKGoldberg JoshuaKGoldberg added the status: in discussion Not yet ready for implementation or a pull request label Mar 10, 2024
@JoshuaKGoldberg
Copy link
Owner

Yeah it's annoying 😕 I've been inconvenienced by this before. It would be nice if the previous state of things could be stored somewhere.

Proposal: how about adding something to the output at the end of --mode migrate? It should:

  • indicate explicitly that GitHub settings were made
  • show the command to run a script that sets values back to what they were

...where the script is a file written to disk?

Would likely be fixed by #1309

I think this will still be an issue there? Since you might not want to preserve rulesets changes.

@johnnyreilly
Copy link
Collaborator

was surprised to see that changes had been made to my repo via the GitHub API (branch protection rules) independently of that PR.

Just to satisfy my own curiosity, what was the nature of the changes made? And to which branch?

@JoshuaKGoldberg
Copy link
Owner

Branch protections get set up on the main branch no matter what:

`PUT /repos/${options.owner}/${options.repository}/branches/main/protection`,

@johnnyreilly
Copy link
Collaborator

"We will protect you whether you like it or not!"

@danvk
Copy link
Contributor Author

danvk commented Mar 10, 2024

I wound up deleting my main branch protection and recreating it as best I could remember.

Would likely be fixed by #1309

I think this will still be an issue there? Since you might not want to preserve rulesets changes.

Right, I misunderstood this GitHub feature. I thought it let you configure rulesets via code, which really would solve the problem.

Still, I wonder if you could create a new ruleset and let the user delete whatever existing branch protections they had before once they're ready to commit. At least then the new ruleset wouldn't be overriding anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: in discussion Not yet ready for implementation or a pull request type: feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

3 participants