Skip to content

Commit

Permalink
feat(logging): add logging for determining current and previous tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Sep 5, 2021
1 parent bbfffd9 commit 1deb19d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ inputs:
skip-prereleases:
required: false
description: If enabled, when a new non-prerelease tag is pushed, the changelog will be created between the pushed tag, and the last non-prerelease tag
default: 'false'
runs:
using: 'node12'
main: 'dist/main.js'
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const searchForPreviousReleaseTag = async (
`The the current tag "${currentReleaseTag}" does not appear to conform to semantic versioning.`,
);
}
core.info(`Valid semver tag found: ${validSemver}`)

const listTagsOptions = client.rest.repos.listTags.endpoint.merge({
...tagInfo,
Expand All @@ -70,13 +71,15 @@ const searchForPreviousReleaseTag = async (
.filter((tag) => tag.semverTag !== null)
.sort((a, b) => semverRcompare(a.semverTag!, b.semverTag!)) as ExtendedTag[];

core.info(`Finding previous tag from list: ${JSON.stringify(tagList)}`)
let previousReleaseTag = null;
for (const tag of tagList) {
if (semverLt(tag.semverTag, currentReleaseTag) && (!skipPreReleases || semverDiff(tag.semverTag, currentReleaseTag) !== "prerelease")) {
previousReleaseTag = tag;
break;
}
}
core.info(`Previous tag to find commits between: ${previousReleaseTag}`)

return previousReleaseTag;
};
Expand Down

0 comments on commit 1deb19d

Please sign in to comment.