-
Notifications
You must be signed in to change notification settings - Fork 56
refactor(ng-dev): create enum for target label names #202
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
Conversation
Instead of hard-coding the label names for the target labels the whole Angular organization uses, we now have an enum for these names, allowing for consistent use of the labels. This is in preparation for adding the proper target labels automatically to staging and cherry-pick release PRs. Previously this was not possible because we still had a possible way to configure custom target labels, and missed such an enum. This new enum came together with some refactorings that cleaned up some of the validation and target label extraction logic. Mostly code has been split up into individual files, allowing for more readable code and less convuluted files.
@josephperrott I'm on M1 right now, so cannot run the formatter, but can tomorrow. This is a good chance asking for your thoughts on another release of buildifier. Their master branch adds support for M1, but we miss a release 😄 |
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.
Overall I think its good, just a few ideas.
An idea after seeing how these pieces work together now, maybe in a different follow up PR. I think we should disentangle pull request merging from pull request validation. I will write up an issue for it to have the discussion there.
ng-dev/pr/merge/target-label.ts
Outdated
* @throws {InvalidTargetLabelError} Invalid label has been applied to pull request. | ||
* @throws {InvalidTargetBranchError} Invalid Github target branch has been selected. | ||
*/ | ||
branches: TargetLabelBranchResult | ((githubTargetBranch: string) => TargetLabelBranchResult); |
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.
To make this simpler should we just change this to
branches: TargetLabelBranchResult | ((githubTargetBranch: string) => TargetLabelBranchResult); | |
branches: (githubTargetBranch: string) => Promise<TargetLabelBranchResult>; |
Since its no longer user configuration that defines TargetLabel
. Currently only one of them is a non-function, and we always await
the branches
value anyway. We could then drop the getBranchesFromTargetLabel
function as well.
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.
👍
Pretter works on M1
c42f9d2
to
6dafe98
Compare
@josephperrott Addressed most of the feedback. thanks. Please have another look |
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.
LGTM
Just one little nit as a proposed change
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Instead of hard-coding the label names for the target labels
the whole Angular organization uses, we now have an enum for
these names, allowing for consistent use of the labels.
This is in preparation for adding the proper target labels
automatically to staging and cherry-pick release PRs. Previously
this was not possible because we still had a possible way to configure
custom target labels, and missed such an enum.
This new enum came together with some refactorings that cleaned up
some of the validation and target label extraction logic. Mostly code
has been split up into individual files, allowing for more readable code
and less convuluted files.
Note: This also fixes
yarn ng-dev pr check-target-branches
if target labels are disabled.