Skip to content

Commit 37f2de6

Browse files
Update readme and exit if invalid version
1 parent 968401c commit 37f2de6

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

README.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,14 @@ SEMVER validator
66

77
### `version`
88

9-
**Required** Version to validate. Default `"0.0.0"`.
10-
11-
## Outputs
12-
13-
### `is-valid`
14-
15-
Return if version is valid.
9+
**Required** Version to validate.
1610

1711
## Example usage
1812

1913
```yaml
2014
uses: actions/semver-validation-action@master
2115
with:
22-
version: '0.7.9'
16+
version: ${{ github.event.release.tag_name }}
2317
```
2418
2519
```yaml

index.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,11 @@ try {
66
const version = core.getInput('version');
77
console.log(`Checking version: ${version}!`);
88

9-
var isValid = false;
10-
console.log(`isValid false`);
119
var re = new RegExp("[0-9]+\.[0-9]+\.[0-9]+(-(0|[1-9]\d*|(beta|alpha).*))?$");
12-
console.log(`RegExp`);
13-
if (re.exec(version) != null) {
14-
isValid = true;
15-
console.log(`isValid true`);
10+
if (re.exec(version) == null) {
11+
core.setFailed("Invalid version");
1612
}
17-
core.setOutput("is-valid", isValid);
18-
console.log(`setOutput`);
19-
// Get the JSON webhook payload for the event that triggered the workflow
20-
const payload = JSON.stringify(github.context.payload, undefined, 2)
21-
console.log(`The event payload: ${payload}`);
13+
2214
} catch (error) {
2315
core.setFailed(error.message);
2416
}

0 commit comments

Comments
 (0)