-
Notifications
You must be signed in to change notification settings - Fork 205
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
fix: get latest maintenance major tag from github releases #2076
fix: get latest maintenance major tag from github releases #2076
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2076 +/- ##
=======================================
Coverage 80.19% 80.19%
=======================================
Files 66 66
Lines 5403 5414 +11
Branches 1254 1262 +8
=======================================
+ Hits 4333 4342 +9
Misses 709 709
- Partials 361 363 +2
Continue to review full report at Codecov.
|
packages/core/src/auto.ts
Outdated
const isPrerelease = this.inPrereleaseBranch(); | ||
|
||
const maintenanceMajor = this.config?.versionBranches && typeof this.config?.versionBranches === "string" && currentBranch?.startsWith(this.config.versionBranches) ? | ||
parseInt(currentBranch.replace(this.config.versionBranches, ""), 10) : null | ||
const [, latestTagInBranch] = await on(this.git.getLatestTagInBranch()); | ||
const lastRelease = | ||
from || |
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.
From my understanding, this will prioritize the from
value over the proper version number that you fetched with your function.
In the following line: https://github.com/intuit/auto/blob/main/packages/core/src/auto.ts#L1688, auto passes in the from: latestTag
from the function getLatestTagInBranch()
. getLatestTagInBranch
can still return the incorrect tag version, and will get prioritized when passed into the getVersion
method from the publishRelease
function here: https://github.com/intuit/auto/blob/main/packages/core/src/auto.ts#L1714, then it will be prioritized over your change.
0465eeb
to
d79865f
Compare
Didn't mean to close it, seems like pushing a reset to origin triggers an auto-close of a PR :P I updated the logic to only include the fix. |
4a86176
to
4cffcdd
Compare
e72fde5
to
17f642f
Compare
d14c773
to
e66ce5a
Compare
@@ -166,18 +166,18 @@ export function findPlugin( | |||
return userPlugin; | |||
} | |||
|
|||
const officialPlugin = path.join("@auto-it", pluginPath); | |||
const canaryPlugin = path.join("@auto-canary", pluginPath); |
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.
This prioritizes Canaries so I could test the NPM plugin 😄
plugins/npm/src/index.ts
Outdated
let isMaintenanceBranch = false; | ||
|
||
if(auto.config?.versionBranches && currentBranch) { | ||
isMaintenanceBranch = currentBranch.includes(typeof auto.config.versionBranches === "boolean" ? "version-" : auto.config.versionBranches) |
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.
Open to thoughts of how to source the default 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.
I think this check could go here as versionBranch
instead (to align with the naming style for how preleaseBranch
), then you could just pass versionBranch
as an argument to getPreviousVersion
directly.
plugins/npm/src/index.ts
Outdated
let isMaintenanceBranch = false; | ||
|
||
if(auto.config?.versionBranches && currentBranch) { | ||
isMaintenanceBranch = currentBranch.includes(typeof auto.config.versionBranches === "boolean" ? "version-" : auto.config.versionBranches) |
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 think this check could go here as versionBranch
instead (to align with the naming style for how preleaseBranch
), then you could just pass versionBranch
as an argument to getPreviousVersion
directly.
🚀 PR was released in |
What Changed
This is a patch fix to tweak the way latest release is determined.
Why
When using
versionBranches
configuration, we observed that the calculated "latest release" relative to the maintenance branch was still the latest overall version, resulting in version conflicts. This change verifies that ifversionBranches
is enabled, then it will:major-2
->2
)env-ci
returns prBranch (undefined) and branch, which happens when merging to a branch that is non-defaultTodo:
Change Type
Indicate the type of change your pull request is:
documentation
patch
minor
major
🐤 Download canary assets:
auto-linux--canary.2076.24992.gz
auto-macos--canary.2076.24992.gz
auto-win.exe--canary.2076.24992.gz
📦 Published PR as canary version:
under canary scope @auto-canary@10.32.2--canary.2076.24992.0
✨ Test out this PR locally via:
npm install @auto-canary/bot-list@10.32.2--canary.2076.24992.0 npm install @auto-canary/auto@10.32.2--canary.2076.24992.0 npm install @auto-canary/core@10.32.2--canary.2076.24992.0 npm install @auto-canary/package-json-utils@10.32.2--canary.2076.24992.0 npm install @auto-canary/all-contributors@10.32.2--canary.2076.24992.0 npm install @auto-canary/brew@10.32.2--canary.2076.24992.0 npm install @auto-canary/chrome@10.32.2--canary.2076.24992.0 npm install @auto-canary/cocoapods@10.32.2--canary.2076.24992.0 npm install @auto-canary/conventional-commits@10.32.2--canary.2076.24992.0 npm install @auto-canary/crates@10.32.2--canary.2076.24992.0 npm install @auto-canary/docker@10.32.2--canary.2076.24992.0 npm install @auto-canary/exec@10.32.2--canary.2076.24992.0 npm install @auto-canary/first-time-contributor@10.32.2--canary.2076.24992.0 npm install @auto-canary/gem@10.32.2--canary.2076.24992.0 npm install @auto-canary/gh-pages@10.32.2--canary.2076.24992.0 npm install @auto-canary/git-tag@10.32.2--canary.2076.24992.0 npm install @auto-canary/gradle@10.32.2--canary.2076.24992.0 npm install @auto-canary/jira@10.32.2--canary.2076.24992.0 npm install @auto-canary/magic-zero@10.32.2--canary.2076.24992.0 npm install @auto-canary/maven@10.32.2--canary.2076.24992.0 npm install @auto-canary/microsoft-teams@10.32.2--canary.2076.24992.0 npm install @auto-canary/npm@10.32.2--canary.2076.24992.0 npm install @auto-canary/omit-commits@10.32.2--canary.2076.24992.0 npm install @auto-canary/omit-release-notes@10.32.2--canary.2076.24992.0 npm install @auto-canary/pr-body-labels@10.32.2--canary.2076.24992.0 npm install @auto-canary/released@10.32.2--canary.2076.24992.0 npm install @auto-canary/s3@10.32.2--canary.2076.24992.0 npm install @auto-canary/sbt@10.32.2--canary.2076.24992.0 npm install @auto-canary/slack@10.32.2--canary.2076.24992.0 npm install @auto-canary/twitter@10.32.2--canary.2076.24992.0 npm install @auto-canary/upload-assets@10.32.2--canary.2076.24992.0 npm install @auto-canary/vscode@10.32.2--canary.2076.24992.0 # or yarn add @auto-canary/bot-list@10.32.2--canary.2076.24992.0 yarn add @auto-canary/auto@10.32.2--canary.2076.24992.0 yarn add @auto-canary/core@10.32.2--canary.2076.24992.0 yarn add @auto-canary/package-json-utils@10.32.2--canary.2076.24992.0 yarn add @auto-canary/all-contributors@10.32.2--canary.2076.24992.0 yarn add @auto-canary/brew@10.32.2--canary.2076.24992.0 yarn add @auto-canary/chrome@10.32.2--canary.2076.24992.0 yarn add @auto-canary/cocoapods@10.32.2--canary.2076.24992.0 yarn add @auto-canary/conventional-commits@10.32.2--canary.2076.24992.0 yarn add @auto-canary/crates@10.32.2--canary.2076.24992.0 yarn add @auto-canary/docker@10.32.2--canary.2076.24992.0 yarn add @auto-canary/exec@10.32.2--canary.2076.24992.0 yarn add @auto-canary/first-time-contributor@10.32.2--canary.2076.24992.0 yarn add @auto-canary/gem@10.32.2--canary.2076.24992.0 yarn add @auto-canary/gh-pages@10.32.2--canary.2076.24992.0 yarn add @auto-canary/git-tag@10.32.2--canary.2076.24992.0 yarn add @auto-canary/gradle@10.32.2--canary.2076.24992.0 yarn add @auto-canary/jira@10.32.2--canary.2076.24992.0 yarn add @auto-canary/magic-zero@10.32.2--canary.2076.24992.0 yarn add @auto-canary/maven@10.32.2--canary.2076.24992.0 yarn add @auto-canary/microsoft-teams@10.32.2--canary.2076.24992.0 yarn add @auto-canary/npm@10.32.2--canary.2076.24992.0 yarn add @auto-canary/omit-commits@10.32.2--canary.2076.24992.0 yarn add @auto-canary/omit-release-notes@10.32.2--canary.2076.24992.0 yarn add @auto-canary/pr-body-labels@10.32.2--canary.2076.24992.0 yarn add @auto-canary/released@10.32.2--canary.2076.24992.0 yarn add @auto-canary/s3@10.32.2--canary.2076.24992.0 yarn add @auto-canary/sbt@10.32.2--canary.2076.24992.0 yarn add @auto-canary/slack@10.32.2--canary.2076.24992.0 yarn add @auto-canary/twitter@10.32.2--canary.2076.24992.0 yarn add @auto-canary/upload-assets@10.32.2--canary.2076.24992.0 yarn add @auto-canary/vscode@10.32.2--canary.2076.24992.0