-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: Add label + assignee select in PR submission #39
base: main
Are you sure you want to change the base?
Conversation
📚
|
let set_assignee = inquire::Confirm::new("Would you like to assign the pull request?") | ||
.with_default(false) | ||
.prompt()?; | ||
let assignees = set_assignee | ||
.then(|| { | ||
let answer = inquire::Text::new("Assignees (comma-separated):") | ||
.prompt()? | ||
.replace(' ', "") | ||
.split(',') | ||
.map(ToString::to_string) | ||
.collect(); | ||
Ok::<_, StError>(answer) | ||
}) | ||
.transpose()?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still think it would be cool if there was an environment variable or global setting that allowed you to automagically set a default assignee.
e.g. if I have ST_DEFAULT_ASSIGNEE=refcell
set, st
doesn't prompt me for an assignee here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small bug, otherwise nice work
Some( | ||
selected_labels | ||
.into_iter() | ||
.map(|label| label.name) | ||
.collect(), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue here. Octocrab will error if it gets an empty vec. This should return Option::None
if selected_labels
is empty.
e.g. error response:
🐙 octocrab error: GitHub { source: GitHubError { documentation_url: Some("https://docs.github.com/rest/issues/labels#add-labels-to-an-issue"), errors: None, message: "Invalid request.\n\nNo subschema in \"anyOf\" matched.\nFor 'anyOf/0', {\"labels\"=>[]} is not an array.\nFor 'anyOf/1', {\"labels\"=>[]} is not an array.\n1 item required; only 0 were supplied.", status_code: 422 }, backtrace: <disabled> }
Overview
Adds two more selects to the PR submission process to select labels and assignees for the PR.
Example
Screen.Recording.2024-11-04.at.12.10.23.PM.mov
Metadata
closes #36