Skip to content

Commit

Permalink
version: take into account current PR labels
Browse files Browse the repository at this point in the history
When running `auto version` from a PR, take into account its labels (not only for the next branch PRs)
  • Loading branch information
laughedelic committed Sep 8, 2022
1 parent 0c96b56 commit f1880a7
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions packages/core/src/auto.ts
Expand Up @@ -1829,23 +1829,20 @@ export default class Auto {

let calculatedBump = await this.release.getSemverBump(lastRelease);

// For next releases we also want to take into account any labels on
// the PR of next into main
if (isPrerelease) {
const pr = getPrNumberFromEnv();

if (pr && this.semVerLabels) {
const prLabels = await this.git.getLabels(pr);
this.logger.verbose.info(
`Found labels on prerelease branch PR`,
prLabels
);
calculatedBump = calculateSemVerBump(
[prLabels, [calculatedBump]],
this.semVerLabels,
this.config
);
}
// Take into account any labels on the PR
const pr = getPrNumberFromEnv();

if (pr && this.semVerLabels) {
const prLabels = await this.git.getLabels(pr);
this.logger.verbose.info(
`Found labels on prerelease branch PR`,
prLabels
);
calculatedBump = calculateSemVerBump(
[prLabels, [calculatedBump]],
this.semVerLabels,
this.config
);
}

const bump =
Expand Down

0 comments on commit f1880a7

Please sign in to comment.