Skip to content

Commit

Permalink
fetch tags
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed May 24, 2023
1 parent b164fdc commit c4abbb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/prepare-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
ref: main-v2
# this needs to be set to a high enough number that it will contain the last version tag
# as of May 2023, the whole repo has 55K commits
# as of May 2023, the whole repo had 55K commits
fetch-depth: 10000

- name: Setup Node.js
Expand Down Expand Up @@ -84,6 +84,10 @@ jobs:
run: |
yarn release:version --release-type ${{ inputs.release-type || 'prerelease' }} ${{ inputs.pre-id && format('{0} {1}', '--pre-id', inputs.pre-id) }} --verbose
# tags are needed for the changelog generation
- name: Fetch git tags
run: git fetch --tags origin

- name: Write changelog
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
5 changes: 5 additions & 0 deletions scripts/release/write-changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ const getFromCommit = async (from?: string | undefined, verbose?: boolean) => {
console.log(`🔍 No 'from' specified, finding latest version tag, fetching all of them...`);
// await git.fetch('origin', ['--all', '--tags']);
const { latest } = await git.tags(['v*', '--sort=-v:refname', '--merged']);
if (!latest) {
throw new Error(
'Could not automatically detect which commit to generate from, because no version tag was found in the history. Have you fetch tags?'
);
}
actualFrom = latest;
if (verbose) {
console.log(`🔍 No 'from' specified, found latest tag: ${chalk.blue(latest)}`);
Expand Down

0 comments on commit c4abbb1

Please sign in to comment.