X Tutup
Skip to content

Add --no-maintainer-edit flag#2250

Merged
vilmibm merged 8 commits intocli:trunkfrom
BjoernAkAManf:add-maintainer-edit-flag
Jan 20, 2021
Merged

Add --no-maintainer-edit flag#2250
vilmibm merged 8 commits intocli:trunkfrom
BjoernAkAManf:add-maintainer-edit-flag

Conversation

@BjoernAkAManf
Copy link
Copy Markdown
Contributor

Closes #2213 while retaining backwards compatibility.

This PR adds no additional tests, as the change is mostly related to the server implementation and not the client implementation.
Furthermore i could not verify it's behavior using a local repository (e.g. the Web UI did not show it as a maintainer and PR requester).

Using the CLI to push it right now though :)

Closes #2213 while retaining backwards compatibility.
@BjoernAkAManf
Copy link
Copy Markdown
Contributor Author

The cli works as expected:
Invoking pr create --maintainer-edit=false
Resulted in:
grafik

(Which i'm now going to enable manually through the WebUI)

Copy link
Copy Markdown
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I'm not sure about the --maintainer-edit flag name, but I can discuss that with my team first to see if we can come up with something that makes sense.

Also, users are not generally aware of the --maintainer-edit=false syntax for boolean flags, so we would have to document that better too.

Do you think we should print some sort of warning or error when both --web and --maintainer-edit=false are used? It doesn't look like we can pass this parameter via URL query parameters for web-based editing 🤔

@mislav mislav added the needs-design An engineering task needs design to proceed label Oct 21, 2020
@BjoernAkAManf
Copy link
Copy Markdown
Contributor Author

I agree, i dont like the name of the flag either.
Alternatively we could switch from a positive flag to --deny-maintainer-edit (also not a fan of the name), which would then allow to leave out =false as well.

I guess i'm too familiar with unix like systems, as that is an intuitive concept to me! Where do you think should the documentation reside? I guess including both the example from above within the examples and a short notice within the long text would be adaquate then right?

How about:

&cobra.Command{
                // [...]
		Long: heredoc.Doc(`
			Create a pull request on GitHub.

			When the current branch isn't fully pushed to a git remote, a prompt will ask where
			to push the branch and offer an option to fork the base repository. Use '--head' to
			explicitly skip any forking or pushing behavior.

			A prompt will also ask for the title and the body of the pull request. Use '--title'
			and '--body' to skip this, or use '--fill' to autofill these values from git commits.

                        By default users with write access to the base respository can add new commits to your branch.
                        If undesired, you may disable access of maintainers by using '--maintainer-edit=false' 
                        You can always change this setting later.
		`),
		Example: heredoc.Doc(`
			$ gh pr create --title "The bug is fixed" --body "Everything works again"
			$ gh pr create --reviewer monalisa,hubot
			$ gh pr create --project "Roadmap"
			$ gh pr create --base develop --head monalisa:feature
			$ gh pr create --maintainer-edit=false
		`),
                 // [...]
}

While i agree we should definitely throw an error if the web based access does not allow to pass the flag. However i would suggest, as this is a github product, and the Web UI already supports this field, to adapt and change this behavior, if possible.
In meantime i can add an error accordingly 👍 .

I'll add my changes this evening.

@niklasmohrin
Copy link
Copy Markdown

niklasmohrin commented Oct 23, 2020

Hey there, thank you for picking the issue up so quickly! I hope you are all well!

From my "user perspective" a name like --no-maintainer-access / --no-external-access seems best, because the flag switches one thing and there is no need for key-value semantics. This is also exactly how I understand the similar --draft flag. I want to amend here that not only maintainers, but everyone that has write access to a repository gets access to a PR branch if the setting is not disabled. Although the checkbox on github.com reads "maintainer", this flag here should maybe reflect this more closely, hence the

/ --no-external-access

Anyway, thank you all for your work on this project, I use it all the time!

@BjoernAkAManf
Copy link
Copy Markdown
Contributor Author

@mislav As the design might still take some time, mind adding a hacktoberfest-accepted label? If you need any changes, feel free to suggest them 😄 .

@manut12za
Copy link
Copy Markdown

#1308

@vilmibm vilmibm self-assigned this Jan 19, 2021
@vilmibm
Copy link
Copy Markdown
Contributor

vilmibm commented Jan 19, 2021

going with --no-maintainer-edit, i'll see it through

@vilmibm vilmibm removed the needs-design An engineering task needs design to proceed label Jan 20, 2021
@vilmibm vilmibm merged commit c9f7927 into cli:trunk Jan 20, 2021
@billygriffin billygriffin changed the title Add --maintainer-edit flag Add --no-maintainer-edit flag Jan 20, 2021
@BjoernAkAManf BjoernAkAManf deleted the add-maintainer-edit-flag branch January 21, 2021 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to disallow edits from maintainers

6 participants

X Tutup