Skip to content

Commit

Permalink
Conditionally add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ncalteen committed Oct 31, 2024
1 parent a9d6c6f commit 33fc4d7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ describe('main', () => {
.mockReturnValueOnce('refs/heads/main') // ref
.mockReturnValueOnce('') // use-version
.mockReturnValueOnce('.') // workspace

process.env.GITHUB_REPOSITORY = 'issue-ops/semver'
})

afterEach(() => {
Expand Down
4 changes: 3 additions & 1 deletion 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.

6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import { versionCheckComment } from './messages.js'
import { Version } from './version.js'

Expand Down Expand Up @@ -38,7 +39,10 @@ export async function run() {

// Check if the version exists.
const exists = await version.exists(workspace, allowPrerelease)
await versionCheckComment(exists, manifestPath)

/* istanbul ignore next */
if (github.context?.issue?.number !== undefined)
await versionCheckComment(exists, manifestPath)

// Fail if checkOnly is true and the version exists.
if (checkOnly && exists)
Expand Down

0 comments on commit 33fc4d7

Please sign in to comment.