File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,9 @@ inputs:
26
26
push :
27
27
description : " Whether to push the new commit back to the repository. Default: true"
28
28
required : false
29
+ upload :
30
+ description : " Whether to upload the new diagram as an artiface. Default: false"
31
+ required : false
29
32
runs :
30
33
using : " node12"
31
34
main : " index.js"
Original file line number Diff line number Diff line change 9
9
"test" : " npm run test:jest --"
10
10
},
11
11
"dependencies" : {
12
+ "@actions/artifact" : " ^0.5.2" ,
12
13
"@actions/core" : " ^1.4.0" ,
13
14
"@actions/exec" : " ^1.1.0" ,
14
15
"d3" : " ^7.0.0" ,
Original file line number Diff line number Diff line change 1
1
import { exec } from '@actions/exec'
2
2
import * as core from '@actions/core'
3
+ import * as artifact from '@actions/artifact'
3
4
import React from 'react' ;
4
5
import ReactDOMServer from 'react-dom/server' ;
5
6
import fs from "fs"
@@ -84,6 +85,19 @@ const main = async () => {
84
85
core . endGroup ( )
85
86
}
86
87
88
+ const shouldUpload = getAsBoolean ( core . getInput ( 'upload' ) , false )
89
+ if ( shouldUpload ) {
90
+ core . startGroup ( 'Upload diagram to artifacts' )
91
+ const client = artifact . create ( )
92
+ const result = await client . uploadArtifact ( 'Diagram' , [ outputFile ] , '.' )
93
+ if ( result . failedItems . length > 0 ) {
94
+ throw 'Artifact was not uploaded successfully.'
95
+ } else {
96
+ core . info ( `Diagram uploaded under name ${ result . artifactName } ` )
97
+ }
98
+ core . endGroup ( )
99
+ }
100
+
87
101
console . log ( "All set!" )
88
102
}
89
103
You can’t perform that action at this time.
0 commit comments