- drop support for tag SHA as in most cases this information is not available at the moment

- introduce new testcase to verify `DAYS_SINCE` calculation
- fix wrong log messages using the `TagInfo` object instead the name
- add additional log messages
This commit is contained in:
Mike Penz
2022-07-26 16:48:06 +02:00
parent c061d0e577
commit d2a15abb64
7 changed files with 81 additions and 23 deletions
+6 -2
View File
@@ -80,7 +80,9 @@ export class ReleaseNotes {
private async getCommitHistory(octokit: Octokit): Promise<DiffInfo> {
const {owner, repo, fromTag, toTag, failOnError} = this.options
core.info(`️ Comparing ${owner}/${repo} - '${fromTag}...${toTag}'`)
core.info(
`️ Comparing ${owner}/${repo} - '${fromTag.name}...${toTag.name}'`
)
const commitsApi = new Commits(octokit)
let diffInfo: DiffInfo
@@ -94,7 +96,9 @@ export class ReleaseNotes {
return DefaultDiffInfo
}
if (diffInfo.commitInfo.length === 0) {
core.warning(`⚠️ No commits found between - ${fromTag}...${toTag}`)
core.warning(
`⚠️ No commits found between - ${fromTag.name}...${toTag.name}`
)
return DefaultDiffInfo
}
+5 -3
View File
@@ -81,11 +81,9 @@ export class Tags {
RestEndpointMethodTypes['repos']['getReleaseByTag']['response']['data']
const release: ReleaseInformation = response.data as ReleaseInformation
tagInfo.date = moment(release.created_at)
core.info(
`️ Retrieved information about the release associated with ${tagInfo.name} from the GitHub API for ${owner}/${repo}`
`️ Retrieved information about the release associated with ${tagInfo.name} from the GitHub API`
)
} catch (error) {
core.info(
@@ -99,6 +97,10 @@ export class Tags {
core.info(
`️ Resolved tag creation time (${creationTimeString}) from 'git for-each-ref --format="%(creatordate:rfc)" "refs/tags/${tagInfo.name}`
)
} else {
core.info(
`⚠️ Could not retrieve tag creation time via git cli 'git for-each-ref --format="%(creatordate:rfc)" "refs/tags/${tagInfo.name}'`
)
}
}
return tagInfo
-8
View File
@@ -313,19 +313,11 @@ export function fillAdditionalPlaceholders(
transformed = transformed.replace(/\${{OWNER}}/g, options.owner)
transformed = transformed.replace(/\${{REPO}}/g, options.repo)
transformed = transformed.replace(/\${{FROM_TAG}}/g, options.fromTag.name)
transformed = transformed.replace(
/\${{FROM_TAG_SHA}}/g,
options.fromTag.commit || ''
)
transformed = transformed.replace(
/\${{FROM_TAG_DATE}}/g,
options.fromTag.date?.toISOString() || ''
)
transformed = transformed.replace(/\${{TO_TAG}}/g, options.toTag.name)
transformed = transformed.replace(
/\${{TO_TAG_SHA}}/g,
options.toTag.commit || ''
)
transformed = transformed.replace(
/\${{TO_TAG_DATE}}/g,
options.toTag.date?.toISOString() || ''