File tree Expand file tree Collapse file tree 3 files changed +45
-15
lines changed Expand file tree Collapse file tree 3 files changed +45
-15
lines changed Original file line number Diff line number Diff line change 9
9
runs-on : ubuntu-latest
10
10
11
11
steps :
12
- - name : Checkout
13
- uses : actions/checkout@v2
12
+ - uses : actions/checkout@v2
13
+ - run : git fetch --prune --unshallow
14
14
- name : Diff
15
15
id : diff
16
16
uses : ./
Original file line number Diff line number Diff line change @@ -961,18 +961,33 @@ const core = __webpack_require__(470)
961
961
const exec = __webpack_require__ ( 986 )
962
962
963
963
async function run ( ) {
964
- const command = 'changelog=$(git log $(git tag --sort version:refname | tail -n 2 | head -n 1)..$(git tag --sort version:refname | tail -n 1) --merges --reverse --pretty=format:"* %b")'
965
- console . log ( command )
966
-
967
964
let output = ''
968
-
969
965
const options = { } ;
970
966
options . listeners = {
971
- stdout : ( data ) => {
972
- output += data . toString ( ) ;
967
+ stdout : ( data ) => {
968
+ output += data . toString ( ) ;
969
+ }
973
970
}
971
+
972
+ const tag_command = 'git tag --sort version:refname'
973
+ console . log ( tag_command )
974
+ await exec . exec ( tag_command , [ ] , options ) . catch ( error => {
975
+ core . setFailed ( error . message )
976
+ } )
977
+
978
+ const tags = output . split ( '\n' ) . filter ( Boolean )
979
+ console . log ( tags )
980
+
981
+ output = ''
982
+
983
+ if ( tags . length < 2 ) {
984
+ core . setFailed ( "need more than 2 tags." )
985
+ return
974
986
}
975
987
988
+ const command = `git log ${ tags [ tags . length - 2 ] } ..${ tags [ tags . length - 1 ] } --merges --reverse --pretty=format:"* %b"`
989
+ console . log ( command )
990
+
976
991
await exec . exec ( command , [ ] , options ) . catch ( error => {
977
992
core . setFailed ( error . message )
978
993
} )
@@ -985,7 +1000,7 @@ async function run() {
985
1000
986
1001
console . log ( output )
987
1002
988
- const setoutput_command = `echo "::set-output name=changelog ::${ output } "`
1003
+ const setoutput_command = `echo "::set-output name=diff ::${ output } "`
989
1004
exec . exec ( setoutput_command ) . catch ( error => {
990
1005
core . setFailed ( error . message )
991
1006
} )
Original file line number Diff line number Diff line change @@ -2,18 +2,33 @@ const core = require('@actions/core')
2
2
const exec = require ( '@actions/exec' )
3
3
4
4
async function run ( ) {
5
- const command = 'changelog=$(git log $(git tag --sort version:refname | tail -n 2 | head -n 1)..$(git tag --sort version:refname | tail -n 1) --merges --reverse --pretty=format:"* %b")'
6
- console . log ( command )
7
-
8
5
let output = ''
9
-
10
6
const options = { } ;
11
7
options . listeners = {
12
- stdout : ( data ) => {
13
- output += data . toString ( ) ;
8
+ stdout : ( data ) => {
9
+ output += data . toString ( ) ;
10
+ }
14
11
}
12
+
13
+ const tag_command = 'git tag --sort version:refname'
14
+ console . log ( tag_command )
15
+ await exec . exec ( tag_command , [ ] , options ) . catch ( error => {
16
+ core . setFailed ( error . message )
17
+ } )
18
+
19
+ const tags = output . split ( '\n' ) . filter ( Boolean )
20
+ console . log ( tags )
21
+
22
+ output = ''
23
+
24
+ if ( tags . length < 2 ) {
25
+ core . setFailed ( "need more than 2 tags." )
26
+ return
15
27
}
16
28
29
+ const command = `git log ${ tags [ tags . length - 2 ] } ..${ tags [ tags . length - 1 ] } --merges --reverse --pretty=format:"* %b"`
30
+ console . log ( command )
31
+
17
32
await exec . exec ( command , [ ] , options ) . catch ( error => {
18
33
core . setFailed ( error . message )
19
34
} )
You can’t perform that action at this time.
0 commit comments