File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed
Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff 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
2014uses : actions/semver-validation-action@master
2115with :
22- version : ' 0.7.9 '
16+ version : ${{ github.event.release.tag_name }}
2317` ` `
2418
2519` ` ` yaml
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments