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

Add arg for changing pull request title #362

Merged
merged 5 commits into from
Apr 25, 2023
Merged

Conversation

mdanish-kh
Copy link
Contributor

@mdanish-kh mdanish-kh commented Apr 17, 2023

Description of the changes

  • Add an optional parameter prTitle to BaseCommand.GitHubSubmitManifests and avoid breaking existing calls of this function.
  • For PR Title validation, let GitHub Api handle the validation and show exception message to user. The downside is (I think) the messages won't be localized, but the upside being anytime the validation (let's say PR title max length) changes at the api side, we wouldn't have to update it manually in the code 👀
  • In case title exceeds max length, it will be caught in ApiValidationException. The current limit seems to be 1024 characters (albeit the error response message says 256 chars)
  • If no title is provided, the default message of <PackageId> version <PackageVersion> will be used.
  • For empty strings with only whitespaces, the exception is caught in ArgumentException
  • Updated E2E tests and docs for the new parameter

Need feedback

Since --prtitle for update command is only applicable when the --submit flag is used, then what if a user was to use --prtitle in the update command without setting the submit flag?

I looked at getting a native solution from CommandLineParser to handle this option dependency on another option, but couldn't find the capability in the module to do so. Related issue: commandlineparser/commandline#3

The alternative would be to handle it manually in the code and print a localized warning message something like "Submit flag is not set. The value of title is ignored.", but since this seems like a harmless scenario I decided not to handle it. Please let me know if I am thinking wrong about any of this.


Microsoft Reviewers: Open in CodeFlow

@mdanish-kh mdanish-kh requested a review from a team as a code owner April 17, 2023 17:09
@mdanish-kh mdanish-kh requested review from yao-msft and ryfu-msft and removed request for a team April 17, 2023 17:09
@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@ryfu-msft ryfu-msft left a comment

Choose a reason for hiding this comment

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

I think what you have is perfectly fine. Ideally, we would want to show a warning message to the user that --submit is needed in combination with --prtitle, but I think the user will ultimately figure that out when they realize that no PR was submitted. I agree with you that this is a pretty harmless/trivial scenario. Everything else looks good :)

@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mdanish-kh
Copy link
Contributor Author

Oopsies, found an unwanted change I mistakenly made in Resources.Designer.cs. Fixed in the recent commit.

@ryfu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ryfu-msft ryfu-msft merged commit dba9587 into microsoft:main Apr 25, 2023
@mdanish-kh mdanish-kh deleted the prTitle branch April 25, 2023 16:45
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.

2 participants