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

feat: add support for releasing from non-master branches for legacy support #429

Merged
merged 20 commits into from
Oct 8, 2020

Conversation

feywind
Copy link
Contributor

@feywind feywind commented May 7, 2020

This PR is the ongoing work for implementing this issue:

#428

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 7, 2020
@bcoe
Copy link
Contributor

bcoe commented Jun 14, 2020

@feywind I think we might be able to pluck the tests from this work into the work here:

#468

I've made it so we now detect whether an alternate default branch has been enabled on GitHub.

@feywind feywind changed the title Add support for releasing from non-master branches for legacy support feat: add support for releasing from non-master branches for legacy support Jun 18, 2020
@sofisl sofisl added sup and removed sup labels Aug 28, 2020
@feywind
Copy link
Contributor Author

feywind commented Sep 15, 2020

sup ... heh. I am still intending to get this merged in, I just need to finish up tests.

@feywind
Copy link
Contributor Author

feywind commented Sep 17, 2020

I was told today that several more teams are interested in this, so I will bump it in my queue accordingly.

Copy link
Contributor

@bcoe bcoe 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 to me, although it's making me wish we'd already switched to sinon for our mocks. Lots of annoying changes.

Thanks for doing this work 👏

src/github.ts Show resolved Hide resolved
src/github.ts Show resolved Hide resolved
src/github.ts Show resolved Hide resolved
src/github.ts Outdated Show resolved Hide resolved
src/graphql-to-commits.ts Show resolved Hide resolved
src/github.ts Outdated Show resolved Hide resolved
@bcoe bcoe marked this pull request as ready for review October 6, 2020 21:16
@bcoe bcoe requested a review from a team as a code owner October 6, 2020 21:16
@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@c61659b). Click here to learn what that means.
The diff coverage is 98.50%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #429   +/-   ##
=========================================
  Coverage          ?   81.78%           
=========================================
  Files             ?       43           
  Lines             ?     5012           
  Branches          ?      436           
=========================================
  Hits              ?     4099           
  Misses            ?      911           
  Partials          ?        2           
Impacted Files Coverage Δ
src/github.ts 79.46% <98.31%> (ø)
src/github-release.ts 93.25% <100.00%> (ø)
src/graphql-to-commits.ts 90.04% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c61659b...490f41f. Read the comment docs.

Copy link
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

It looks like GitHub#defaultBranch is a misnomer now and should be baseBranch which defaults to the detected default branch.

It might simplify the code if we provide the base branch as a parameter to the relative methods - the same GitHub instance could be used for multiple base (releasable) branches.

Conceptually, do we expect separate release-please invocations for each base branch -or- iterating over a list of base branches (via configuration) in the same invocation?

@@ -312,31 +320,36 @@ export class GitHub {
maxLabels = 16,
retries = 0
): Promise<CommitsResponse> {
const baseBranch = await this.getDefaultBranch();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a method argument where the caller can provide the base branch name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I saw this could go either way... what we had before was that methods had to supply options.defaultBranch each time, and then it got cached, so the future invocations ignored the parameter. Which seems a bit deceptive.

I'm fine with going the other way, too, just make it have to be passed each time and caching the result value by key or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I missed your last comment - my intent is that this first pass would just allow someone to run it from the command line on a onesies-basis, but I'm intending to follow it up with one that will read a list of branches from the .release-please.yaml file in a repo. So I'm good with assuming that's where things need to go, one way or another.

@@ -226,53 +227,59 @@ export class GitHub {
maxFilesChanged = 64,
retries = 0
): Promise<CommitsResponse> {
const baseBranch = await this.getDefaultBranch();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a method argument where the caller can provide the base branch name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants