File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 11
11
- ' *'
12
12
branches :
13
13
- ' *'
14
+ create :
14
15
15
16
jobs :
16
17
test :
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ We currently support:
12
12
- ` release `
13
13
- ` push ` (tags, commits)
14
14
- ` schedule `
15
+ - ` create (branch) `
15
16
16
17
## Messages
17
18
@@ -65,6 +66,12 @@ All event messages will have these elements:
65
66
66
67
> Note that Schedule does not have the user as there's no commit information.
67
68
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
+
68
75
## Usage
69
76
70
77
You 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 = () => {
12842
12842
return `Scheduled Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } >` ;
12843
12843
}
12844
12844
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
+
12845
12857
default :
12846
12858
return null ;
12847
12859
}
@@ -12858,6 +12870,7 @@ const notify = async (status, url) => {
12858
12870
const message = getMessage ( ) ;
12859
12871
12860
12872
if ( ! message ) {
12873
+ core$1 . debug ( JSON . stringify ( github . context ) ) ;
12861
12874
console . log ( `We don't support the [${ github . context . eventName } ] event yet.` ) ;
12862
12875
return ;
12863
12876
}
Original file line number Diff line number Diff line change 1
1
import got from 'got' ;
2
+ import core from '@actions/core' ;
2
3
import { context } from '@actions/github' ;
3
4
4
5
export type JobStatus = 'success' | 'failure' | 'cancelled' ;
@@ -87,6 +88,18 @@ const getMessage = () => {
87
88
return `Scheduled Workflow <${ runUrl } |${ process . env . GITHUB_WORKFLOW } >` ;
88
89
}
89
90
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
+
90
103
default :
91
104
return null ;
92
105
}
@@ -101,6 +114,7 @@ const notify = async (status: JobStatus, url: string) => {
101
114
const message = getMessage ( ) ;
102
115
103
116
if ( ! message ) {
117
+ core . debug ( JSON . stringify ( context ) ) ;
104
118
console . log ( `We don't support the [${ context . eventName } ] event yet.` ) ;
105
119
return ;
106
120
}
You can’t perform that action at this time.
0 commit comments