-
Notifications
You must be signed in to change notification settings - Fork 176
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
Environment custom branch policies support type ('branch', 'tag') #910
base: master
Are you sure you want to change the base?
Environment custom branch policies support type ('branch', 'tag') #910
Conversation
@goruha is attempting to deploy a commit to the Repository Settings Team on Vercel. A member of the Team first needs to authorize it. |
@julekirk @mayliang021 @travi |
supporting tag targets feels separate from what makes sense under "custom_branches". would a separate section for tags be a better fit? |
Yeah, the separate settings for tags look better. |
@travi can we have this PR merged? |
in general, i agree. however, as mentioned in the docs for the environments plugin, we already deviate a bit, so that is the reason that gave me pause here. since even the github api still uses the branches terminology for this, i think i'm ok with proceeding with the proposed approach |
this.customBranches = any.listOf(() => ({ | ||
name: any.word(), | ||
id: any.integer(), | ||
type: any.fromList(['branch', 'tag']) |
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.
i appreciate that you tracked down how to accomplish this and i think this is totally valid for the scenario that defines type
, but i think this change now results in not having a scenario tested for the option to not include type, doesnt it. it seems like we probably should define an additional scenario for including type in https://github.com/repository-settings/app/blob/master/test/integration/features/environments.feature
i also wonder if the inclusion of a type that doesnt match the default requires any additional care to avoid unnecessary update requests when the intended value matches what is in the api. could you verify that comparing an existing rule in the api avoids extra calls when the type is and is not present in the settings.yml? if that requires additional logic to avoid extra calls, we may need test scenarios for those cases 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.
Actually, we always specify type
for API calls.
https://github.com/repository-settings/app/pull/910/files#diff-d3173e671826d864f026b433955eeef4008090a5fc6c3111f8ec2e3977e2bc4dR156
So, the test is correct and does not dismiss the case without type.
name: rule.name || rule, | ||
type: rule.type || 'branch' |
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.
because of the default values, i think we also need to handle similar in
app/lib/plugins/environments.js
Lines 54 to 59 in 36173c5
function deploymentBranchPolicyHasChanged (existing, attrs) { | |
return ( | |
deploymentBranchPolicyToString(existing.deployment_branch_policy) !== | |
deploymentBranchPolicyToString(attrs.deployment_branch_policy) | |
) | |
} |
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.
@travi, thanks for the nice catch.
I'll address this comment this week.
What
type
support for environmentdeployment_branch_policy
custom branches.Why
deployment_branch_policy
supports custom branches type -branch
ortag
. The type is an option parameter that setsbranch
by default. These changes allow us to specify deployment_branch_policy fortag
Config example
You can specify
custom_branches
list item asstring
for back-compatibility or as objectReleated links