Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output on check-only mode #50

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "semver",
"description": "Semantically version GitHub repository tags",
"version": "1.0.0",
"version": "1.1.0",
"author": "Nick Alteen <[email protected]>",
"homepage": "https://github.com/issue-ops/semver#readme",
"repository": {
Expand Down
15 changes: 7 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ export async function run() {
if (version === undefined) return core.setFailed('Could not infer version')

// Stop now if we're only checking the version.
if (checkOnly)
if (await version.exists(workspace))
return core.setFailed("Version already exists and 'check-only' is true")
else return core.info("Version does not exist and 'check-only' is true")
if (checkOnly && (await version.exists(workspace)))
return core.setFailed("Version already exists and 'check-only' is true")

// Check if the tags already exist in the repository.
if (!overwrite && (await version.exists(workspace)))
if (!checkOnly && !overwrite && (await version.exists(workspace)))
return core.setFailed("Version already exists and 'overwrite' is false")

core.info(`Inferred Version: ${version.toString()}`)
core.info(`Tagging ${ref} with version ${version.toString()}`)

// Tag and push the version in the workspace
await version.tag(ref, workspace)
core.info('Tagging complete')
// If not running in checkOnly mode, tag and push the version in the
// workspace. Otherwise, just output the version information.
if (!checkOnly) await version.tag(ref, workspace)
else core.info("Version does not exist and 'check-only' is true")

// Output the various version formats
// [X.Y.Z-PRE+BUILD, X.Y.Z, X.Y, X, Y, Z, PRE, BUILD]
Expand Down
2 changes: 2 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ export class Version {
// Ignore stderr if the tag was pushed
if (tagOptions.stderr.includes('[new tag]') === false)
throw new Error(tagOptions.stderr)

core.info('Tagging complete')
}

/**
Expand Down