File tree 2 files changed +5
-19
lines changed
2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,14 @@ SEMVER validator
6
6
7
7
### ` version `
8
8
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.
16
10
17
11
## Example usage
18
12
19
13
``` yaml
20
14
uses : actions/semver-validation-action@master
21
15
with :
22
- version : ' 0.7.9 '
16
+ version : ${{ github.event.release.tag_name }}
23
17
` ` `
24
18
25
19
` ` ` yaml
Original file line number Diff line number Diff line change 6
6
const version = core . getInput ( 'version' ) ;
7
7
console . log ( `Checking version: ${ version } !` ) ;
8
8
9
- var isValid = false ;
10
- console . log ( `isValid false` ) ;
11
9
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" ) ;
16
12
}
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
+
22
14
} catch ( error ) {
23
15
core . setFailed ( error . message ) ;
24
16
}
You can’t perform that action at this time.
0 commit comments