File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 - ' *'
1212 branches :
1313 - ' *'
14+ create :
1415
1516jobs :
1617 test :
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ We currently support:
1212- ` release `
1313- ` push ` (tags, commits)
1414- ` schedule `
15+ - ` create (branch) `
1516
1617## Messages
1718
@@ -65,6 +66,12 @@ All event messages will have these elements:
6566
6667> Note that Schedule does not have the user as there's no commit information.
6768
69+ ### Create
70+
71+ ![ Create] ( https://user-images.githubusercontent.com/5962998/104134782-22c26e00-5362-11eb-9855-d40b6fc1bf7d.png )
72+
73+ 1 . Branch Name - Also link to the branch.
74+
6875## Usage
6976
7077You can use this action after any other action, however I recommend you put it as the last one. Here is an example setup of this action for a pull request:
Original file line number Diff line number Diff line change @@ -12842,6 +12842,18 @@ const getMessage = () => {
1284212842 return `Scheduled Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } >` ;
1284312843 }
1284412844
12845+ case 'create' :
12846+ {
12847+ if ( github . context . payload . ref_type !== 'branch' ) {
12848+ return null ;
12849+ }
12850+
12851+ const pre = 'refs/heads/' ;
12852+ const branchName = github . context . ref . substring ( pre . length ) ;
12853+ const branchUrl = `${ github . context . payload . repository . html_url } /tree/${ branchName } ` ;
12854+ return `Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } > for Creation of Branch <${ branchUrl } |${ branchName } >` ;
12855+ }
12856+
1284512857 default :
1284612858 return null ;
1284712859 }
@@ -12858,6 +12870,7 @@ const notify = async (status, url) => {
1285812870 const message = getMessage ( ) ;
1285912871
1286012872 if ( ! message ) {
12873+ core$1 . debug ( JSON . stringify ( github . context ) ) ;
1286112874 console . log ( `We don't support the [${ github . context . eventName } ] event yet.` ) ;
1286212875 return ;
1286312876 }
Original file line number Diff line number Diff line change 11import got from 'got' ;
2+ import core from '@actions/core' ;
23import { context } from '@actions/github' ;
34
45export type JobStatus = 'success' | 'failure' | 'cancelled' ;
@@ -87,6 +88,18 @@ const getMessage = () => {
8788 return `Scheduled Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } >` ;
8889 }
8990
91+ case 'create' : {
92+ if ( context . payload . ref_type !== 'branch' ) {
93+ return null ;
94+ }
95+
96+ const pre = 'refs/heads/' ;
97+ const branchName = context . ref . substring ( pre . length ) ;
98+ const branchUrl = `${ context . payload . repository . html_url } /tree/${ branchName } ` ;
99+
100+ return `Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } > for Creation of Branch <${ branchUrl } |${ branchName } >` ;
101+ }
102+
90103 default :
91104 return null ;
92105 }
@@ -101,6 +114,7 @@ const notify = async (status: JobStatus, url: string) => {
101114 const message = getMessage ( ) ;
102115
103116 if ( ! message ) {
117+ core . debug ( JSON . stringify ( context ) ) ;
104118 console . log ( `We don't support the [${ context . eventName } ] event yet.` ) ;
105119 return ;
106120 }
You can’t perform that action at this time.
0 commit comments