Skip to content

Commit 786bd2b

Browse files
committed
Fetch all tags first before getting the latest one
1 parent 5aba295 commit 786bd2b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/code-infra/src/utils/changelog.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import { $ } from 'execa';
1919
* @returns {Promise<string>}
2020
*/
2121
export async function findLatestTaggedVersion(opts) {
22-
const { stdout } = await $({ cwd: opts.cwd })`git describe --tags --abbrev=0 --match ${'v*'}`; // only include "version-tags"
22+
const $$ = $({ cwd: opts.cwd });
23+
await $$`git fetch --tags`;
24+
const { stdout } = await $$`git describe --tags --abbrev=0 --match ${'v*'}`; // only include "version-tags"
2325
return stdout.trim();
2426
}
2527

@@ -34,8 +36,7 @@ export async function findLatestTaggedVersion(opts) {
3436

3537
/**
3638
* Fetches commits between two refs (lastRelease..release) including PR details.
37-
* It first tries to use the GraphQL API (more efficient) and falls back to the
38-
* REST api if it fails with server error.
39+
* Throws if the `token` option is not provided.
3940
*
4041
* @param {FetchCommitsOptions} param0
4142
* @returns {Promise<FetchedCommitDetails[]>}

0 commit comments

Comments
 (0)