File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,16 @@ inputs:
1717 description : ' Skip the unshallow operation: "true" or "false"'
1818 required : false
1919 default : ' false'
20+ abbrev :
21+ description : ' value to pass the --abbrev flag. false to disable, default 0'
22+ required : false
23+ default : 0
2024outputs :
2125 tag :
2226 description : ' The found tag'
2327runs :
2428 using : ' node12'
2529 main : ' main.js'
2630branding :
27- icon : ' hash'
31+ icon : ' hash'
2832 color : ' green'
Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ try {
1919 const exclude = getInput ( 'exclude' ) ;
2020 const commitIsh = getInput ( 'commit-ish' ) ;
2121 const skipUnshallow = getInput ( 'skip-unshallow' ) === 'true' ;
22+ const abbrev = getInput ( "abbrev" ) ;
2223
2324 var includeOption = '' ;
2425 var excludeOption = '' ;
2526 var commitIshOption = '' ;
27+ var abbrevOption = '' ;
2628
2729 if ( typeof include === 'string' && include . length > 0 ) {
2830 includeOption = `--match '${ include } '` ;
@@ -39,10 +41,14 @@ try {
3941 commitIshOption = `'${ commitIsh } '` ;
4042 }
4143
44+ if ( abbrev !== 'false' ) {
45+ abbrevOption = `--abbrev=${ abbrev } ` ;
46+ }
47+
4248 var unshallowCmd = skipUnshallow ? '' : 'git fetch --prune --unshallow &&'
4349
4450 // actions@checkout performs a shallow checkout. Need to unshallow for full tags access.
45- var cmd = `${ unshallowCmd } git describe --tags --abbrev=0 ${ includeOption } ${ excludeOption } ${ commitIshOption } ` . replace ( / [ ] + / , ' ' ) . trim ( ) ;
51+ var cmd = `${ unshallowCmd } git describe --tags ${ abbrevOption } ${ includeOption } ${ excludeOption } ${ commitIshOption } ` . replace ( / [ ] + / , ' ' ) . trim ( ) ;
4652 console . log ( `Executing: ${ cmd } ` ) ;
4753
4854 exec ( cmd , ( err , tag , stderr ) => {
You can’t perform that action at this time.
0 commit comments