Skip to content

Commit

Permalink
fix: dont fetch tags if tags arg is empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Apr 9, 2022
1 parent f502f89 commit 3a79558
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -40,8 +39,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { execaSync } from "execa";
* @internal
*/
function getTags(branch, execaOptions, filters) {
let tags = execaSync("git", ["tag", "--merged", branch], execaOptions).stdout;
let tags = execaSync("git", ["tag", "--merged"], execaOptions).stdout;
tags = tags
.split("\n")
.map((tag) => tag.trim())
Expand Down
4 changes: 2 additions & 2 deletions lib/updateDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const getNextPreVersion = (pkg, tags) => {
// 3. Resolve the versions from the tags
// TODO: replace {cwd: '.'} with multiContext.cwd
if (pkg.name) tagFilters.push(pkg.name);
if (!tags || !tags.length) {
tags = getTags(pkg._branch, { cwd: "." }, tagFilters);
if (!tags) {
tags = getTags(pkg._branch, { cwd: process.cwd() }, tagFilters);
}

const lastPreRelTag = getPreReleaseTag(lastVersion);
Expand Down
4 changes: 2 additions & 2 deletions test/bin/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("multi-semantic-release CLI", () => {
// expect(out).toMatch("Released 4 of 4 packages, semantically!");

try {
await execa("node", [filepath, "-- --no-sequential-prepare --no-ci"], { cwd });
await execa("node", [filepath, "-- --no-sequential-prepare", "--no-ci"], { cwd });
} catch (res) {
const { stdout, stderr, exitCode } = res;

Expand All @@ -58,7 +58,7 @@ describe("multi-semantic-release CLI", () => {

// Run via command line.
const out = (
await execa("node", [filepath, "-- --ignore-packages=packages/c/**,packages/d/** --no-ci"], { cwd })
await execa("node", [filepath, "-- --ignore-packages=packages/c/**,packages/d/**", "--no-ci"], { cwd })
).stdout;
expect(out).toMatch("Started multirelease! Loading 2 packages...");
expect(out).toMatch("Released 2 of 2 packages, semantically!");
Expand Down

0 comments on commit 3a79558

Please sign in to comment.