File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed
Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ inputs:
1919 required : false
2020 description : ' A comma separated list of languages to exclude'
2121 default : ' '
22+ AUTO_PUSH :
23+ required : false
24+ description : ' Whether automatically push generated files to desired branch'
25+ default : true
2226
2327runs :
2428 using : ' node16'
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ const action = async () => {
4242 core . info ( `UTC offset: ${ utcOffset } ` ) ;
4343 const exclude = core . getInput ( 'EXCLUDE' , { required : false } ) . split ( ',' ) ;
4444 core . info ( `Excluded languages: ${ exclude } ` ) ;
45+ const isAutoPush = core . getInput ( 'AUTO_PUSH' , { required : false } ) ;
46+ core . info ( `You ${ isAutoPush ? 'have' : "haven't" } set automatically push commits` ) ;
47+
4548 try {
4649 // Remove old output
4750 core . info ( `Remove old cards...` ) ;
@@ -95,18 +98,20 @@ const action = async () => {
9598 }
9699
97100 // Commit changes
98- core . info ( `Commit file...` ) ;
99- let retry = 0 ;
100- const maxRetry = 3 ;
101- while ( retry < maxRetry ) {
102- retry += 1 ;
103- try {
104- await commitFile ( ) ;
105- } catch ( error ) {
106- if ( retry == maxRetry ) {
107- throw error ;
101+ if ( isAutoPush ) {
102+ core . info ( `Commit file...` ) ;
103+ let retry = 0 ;
104+ const maxRetry = 3 ;
105+ while ( retry < maxRetry ) {
106+ retry += 1 ;
107+ try {
108+ await commitFile ( ) ;
109+ } catch ( error ) {
110+ if ( retry == maxRetry ) {
111+ throw error ;
112+ }
113+ core . warning ( `Commit failed. Retry...` ) ;
108114 }
109- core . warning ( `Commit failed. Retry...` ) ;
110115 }
111116 }
112117 } catch ( error : any ) {
You can’t perform that action at this time.
0 commit comments