File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,14 @@ async function notifyTestResults() {
38
38
}
39
39
40
40
let message = `E2E Tests ${ status } ` ;
41
+ let versionOrTag ;
41
42
42
43
// Add version if it can find it in the workflow_dispatch event data.
43
44
if ( process . env . GITHUB_EVENT_PATH ) {
44
45
const wrPayload = require ( process . env . GITHUB_EVENT_PATH ) ;
45
46
if ( wrPayload . inputs && wrPayload . inputs . versionOrTag ) {
46
47
message += ` for release ${ wrPayload . inputs . versionOrTag } .` ;
48
+ versionOrTag = wrPayload . inputs . versionOrTag ;
47
49
} else {
48
50
console . log ( `Couldn't find versionOrTag in event payload.` ) ;
49
51
}
@@ -102,13 +104,24 @@ async function notifyTestResults() {
102
104
103
105
req . on ( 'error' , error => reject ( error ) ) ;
104
106
105
- req . write (
106
- JSON . stringify ( {
107
- testStatus,
108
- testUrl : workflowUrl
109
- } ) ,
110
- err => reject ( err )
111
- ) ;
107
+ const data = {
108
+ testStatus,
109
+ testUrl : workflowUrl
110
+ } ;
111
+
112
+ if ( versionOrTag ) {
113
+ // Matches a staging version tag pattern.
114
+ const match = versionOrTag . match ( / ^ ( \d + .\d + .\d + ) - \d + $ / ) ;
115
+ if ( match ) {
116
+ // Remove suffix from staging version
117
+ data . version = match [ 1 ] ;
118
+ // Full staging version with tag
119
+ data . tag = versionOrTag ;
120
+ } else {
121
+ data . version = versionOrTag ;
122
+ }
123
+ }
124
+ req . write ( JSON . stringify ( data ) , err => reject ( err ) ) ;
112
125
req . end ( ) ;
113
126
} ) ;
114
127
You can’t perform that action at this time.
0 commit comments