File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343| skip-verify-authority | Skip verify by creator authority. Option: ` read` `write` `admin` | string | ✖ |
4444| skip-verify-users | Skip verify by creator userid. Support multiple | string | ✖ |
4545| skip-label | Skip label | string | ✖ |
46+ | skip-contribution-count | Skip verify by commit count | number | ✖ |
4647| comment | Comment when verification success | string | ✖ |
4748| comment-mark | Comment mark to find. | string | ✖ |
4849| assignees | Assignees when verification success | string | ✖ |
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ inputs:
1818 description : Skip verify by github userid.
1919 skip-label :
2020 description : Skip verify by pr label.
21+ skip-contribution-count :
22+ description : Skip verify by commits count.
2123 forbid-files :
2224 description : Forbid files. Higher than allowed.
2325 forbid-paths :
@@ -38,5 +40,5 @@ inputs:
3840 description : When hit, whether set failed.
3941
4042runs :
41- using : ' node12 '
43+ using : ' node20 '
4244 main : ' dist/index.js'
Original file line number Diff line number Diff line change 1818 "dependencies" : {
1919 "@actions/core" : " ^1.2.6" ,
2020 "@actions/github" : " ^4.0.0" ,
21- "@octokit/rest" : " ^18 .0.14 " ,
21+ "@octokit/rest" : " ^22 .0.0 " ,
2222 "actions-util" : " ^1.0.0"
2323 },
2424 "devDependencies" : {
2525 "@umijs/fabric" : " ^2.5.6" ,
26- "@vercel/ncc" : " ^0.27 .0" ,
26+ "@vercel/ncc" : " 0.34 .0" ,
2727 "prettier" : " ^2.2.1"
2828 }
2929}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ async function run() {
2727 const skipVerifyUsers = core . getInput ( 'skip-verify-users' ) ;
2828 const skipLabel = core . getInput ( 'skip-label' ) ;
2929 const setFailedInput = core . getInput ( 'set-failed' ) ;
30+ const skipContributionCount = core . getInput ( 'skip-contribution-count' ) ;
3031
3132 if ( skipLabel && labels && labels . length ) {
3233 const labelsName = labels . map ( ( { name } ) => name ) ;
@@ -78,12 +79,28 @@ async function run() {
7879 return out ;
7980 }
8081
82+ async function checkCommitsCount ( ) {
83+ const res = await octokit . repos . listCommits ( {
84+ owner,
85+ repo,
86+ author : creator ,
87+ per_page : skipContributionCount ,
88+ } ) ;
89+ const out = res . data . length >= skipContributionCount ;
90+ core . info ( `The user ${ creator } check commits count ${ out } !` ) ;
91+ return out ;
92+ }
93+
8194 let result = false ;
8295
8396 if ( skipVerifyAuthority ) {
8497 result = await checkAuthority ( ) ;
8598 }
8699
100+ if ( ! result && skipContributionCount ) {
101+ result = await checkCommitsCount ( ) ;
102+ }
103+
87104 if ( ! result ) {
88105 const changeFiles = await getFiles ( ) ;
89106 if ( changeFiles . length == 0 ) {
You can’t perform that action at this time.
0 commit comments