Skip to content

Commit

Permalink
Add comment input to allow/prevent version check comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ncalteen committed Nov 7, 2024
1 parent 66505b8 commit 5d27765
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ version is updated when new features are released.
| ------------------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `allow-prerelease` | `'true'` | If `check-only` is `'true'`, this controls if the check should pass if a matching prerelease version is detected (e.g. `v1.0.0-SNAPSHOT`). |
| `check-only` | `'false'` | If set to `'true'`, only checks if the version exists. Fails the action if the version already exists. |
| `comment` | `'true'` | If set to `'true'`, a comment will be added to the pull request indicating if the version is valid or conflicts with an existing version. |
| `manifest-path` | | The path to the manifest that contains the version (relative to the root of the repository). |
| | | If not set, `use-version` must be set. |
| `overwrite` | `'false'` | Set to `'true'` to overwrite existing tags. |
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ inputs:
If set to 'true', the action will only check if the version exists and, if
so, will fail. Defaults to 'false'.
required: false
comment:
default: 'true'
description:
If set to 'true', the action will comment on the pull request indicating
if the version is valid. Defaults to 'true'.
required: false
manifest-path:
description:
The path to the manifest file that contains the version information,
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.

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": "issue-ops-semver",
"description": "Semantically version GitHub repository tags",
"version": "2.3.2",
"version": "2.4.0",
"type": "module",
"author": "Nick Alteen <ncalteen@github.com>",
"homepage": "https://github.com/issue-ops/semver#readme",
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export async function run() {
const useVersion: string = core.getInput('use-version')
const workspace: string = core.getInput('workspace')
const push: boolean = core.getInput('push-tags') === 'true'
const comment: boolean = core.getInput('comment') === 'true'

if (
(manifestPath === '' && useVersion === '') ||
Expand Down Expand Up @@ -46,7 +47,8 @@ export async function run() {
if (
github.context.issue?.number !== undefined &&
github.context.eventName === 'pull_request' &&
github.context.payload?.action !== 'closed'
github.context.payload?.action !== 'closed' &&
comment
)
await versionCheckComment(!exists, manifestPath)

Expand Down

0 comments on commit 5d27765

Please sign in to comment.