Skip to content

Commit

Permalink
feat(getMostRecentTags): add fetchRemote option to allow disabling re…
Browse files Browse the repository at this point in the history
…mote fetching
  • Loading branch information
legobeat committed Aug 13, 2024
1 parent 361c7f0 commit a0693f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/update-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@ import { PackageRename } from './shared-types';
* Get the most recent tag for a project.
*
* @param options - Options.
* @param options.fetchRemote - Whether to synchronize local tags with remote.
* @param options.tagPrefixes - A list of tag prefixes to look for, where the first is the intended
* prefix and each subsequent prefix is a fallback in case the previous tag prefixes are not found.
* @returns The most recent tag.
*/
async function getMostRecentTag({
fetchRemote,
tagPrefixes,
}: {
fetchRemote?: boolean;
tagPrefixes: [string, ...string[]];
}) {
// Ensure we have all tags on remote
await runCommand('git', ['fetch', '--tags']);
if (typeof fetchRemote !== 'boolean' || fetchRemote) {
await runCommand('git', ['fetch', '--tags']);
}

let mostRecentTagCommitHash: string | null = null;
for (const tagPrefix of tagPrefixes) {
Expand Down

0 comments on commit a0693f8

Please sign in to comment.