File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 44 token :
55 description : ' A token with access to your repository scoped in as a secret'
66 required : true
7+ filter_out_pattern :
8+ description : ' A regex pattern to check if a commit should be filtered out, empty for disable'
9+ required : false
10+ default : " "
11+ filter_out_flags :
12+ description : ' Regex flags of input filter_out_pattern'
13+ required : false
14+ default : ' '
715outputs :
816 commits :
917 description : ' commits in pr'
Original file line number Diff line number Diff line change @@ -13,15 +13,26 @@ async function main() {
1313 }
1414
1515 const token = core . getInput ( 'token' )
16+ const filterOutPattern = core . getInput ( 'filter_out_pattern' )
17+ const filterOutFlags = core . getInput ( 'filter_out_flags' )
1618 const octokit = new github . GitHub ( token )
1719
18- const commits = await octokit . pulls . listCommits ( {
20+ const commitsListed = await octokit . pulls . listCommits ( {
1921 owner : repo . owner . login ,
2022 repo : repo . name ,
2123 pull_number : pr . number ,
2224 } )
2325
24- core . setOutput ( 'commits' , JSON . stringify ( commits . data ) )
26+ let commits = commitsListed . data
27+
28+ if ( filterOutPattern ) {
29+ const regex = new RegExp ( filterOutPattern , filterOutFlags )
30+ commits = commits . filter ( ( { commit} ) => {
31+ return ! regex . test ( commit . message )
32+ } )
33+ }
34+
35+ core . setOutput ( 'commits' , JSON . stringify ( commits ) )
2536 } catch ( error ) {
2637 core . setFailed ( error . message )
2738 }
Original file line number Diff line number Diff line change 11{
22 "name" : " get-pr-commits" ,
3- "version" : " 1.0 .0" ,
3+ "version" : " 1.1 .0" ,
44 "description" : " " ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments