From 2ee0b297bd2baf86dee21f124a9705474093f35b Mon Sep 17 00:00:00 2001 From: Paul Hatcherian <1835615+PaulHatch@users.noreply.github.com> Date: Mon, 4 Apr 2022 20:52:06 -0400 Subject: [PATCH] Include additional metadata outputs --- src/VersionResult.ts | 8 ++++++-- src/action.ts | 8 ++++++-- src/main.ts | 5 ++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/VersionResult.ts b/src/VersionResult.ts index 14a8888..b864227 100644 --- a/src/VersionResult.ts +++ b/src/VersionResult.ts @@ -12,7 +12,9 @@ export class VersionResult { * @param versionTag - The string to be used as a Git tag * @param changed - True if the version was changed, otherwise false * @param authors - Authors formatted according to the format mode (e.g. JSON, CSV, YAML, etc.) - * @param currentCommit - The current commit hash + * @param currentCommit - The current commit hash + * @param previousCommit - The previous commit hash + * @param previousVersion - the previous version */ constructor( public major: number, @@ -23,5 +25,7 @@ export class VersionResult { public versionTag: string, public changed: boolean, public authors: string, - public currentCommit: string) { } + public currentCommit: string, + public previousCommit: string, + public previousVersion: string) { } } diff --git a/src/action.ts b/src/action.ts index 16bb29d..b6b4c85 100644 --- a/src/action.ts +++ b/src/action.ts @@ -25,7 +25,9 @@ export async function runAction(configurationProvider: ConfigurationProvider): P tagFormmater.Format(versionInfo), versionInfo.changed, userFormatter.Format('author', []), - '' + '', + '', + '0.0.0' ); } @@ -62,6 +64,8 @@ export async function runAction(configurationProvider: ConfigurationProvider): P tagFormmater.Format(versionInfo), versionInfo.changed, userFormatter.Format('author', authors), - currentCommit + currentCommit, + lastRelease.hash, + `${lastRelease.major}.${lastRelease.minor}.${lastRelease.patch}` ); } diff --git a/src/main.ts b/src/main.ts index 6aa5d66..a74a9f0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,7 @@ import { VersionResult } from './VersionResult'; import * as core from '@actions/core'; function setOutput(versionResult: VersionResult) { - const { major, minor, patch, increment, formattedVersion, versionTag, changed, authors, currentCommit } = versionResult; + const { major, minor, patch, increment, formattedVersion, versionTag, changed, authors, currentCommit, previousCommit, previousVersion } = versionResult; const repository = process.env.GITHUB_REPOSITORY; @@ -26,6 +26,9 @@ function setOutput(versionResult: VersionResult) { core.setOutput("changed", changed.toString()); core.setOutput("version_tag", versionTag); core.setOutput("authors", authors); + core.setOutput("lastVersion", authors); + core.setOutput("previous_commit", previousCommit); + core.setOutput("previous_version", previousVersion); } export async function run() {