8000 Expose the SVG as an output · githubocto/repo-visualizer@cde6336 · GitHub
[go: up one dir, main page]

Skip to content

Commit cde6336

Browse files
committed
Expose the SVG as an output
1 parent 1121214 commit cde6336

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ If unspecified, no artifact will be created.
8080

8181
Default: `''` (no artifact)
8282

83+
## Outputs
84+
85+
## `svg`
86+
87+
The contents of the diagram as text. This can be used if you don't want to handle new files.
88+
8389
## Examp 10000 le usage
8490

8591
You'll need to run the `actions/checkout` Action beforehand, to check out the code.
@@ -108,6 +114,7 @@ or by using the [GitHub API](https://docs.github.com/en/rest/reference/actions#a
108114
Example:
109115
```yaml
110116
- name: Update diagram
117+
id: make_diagram
111118
uses: githubocto/repo-visualizer@0.6.1
112119
with:
113120
output_file: "images/diagram.svg"
@@ -120,3 +127,6 @@ Example:
120127
# Diagram now available at downloads/images/diagram.svg
121128
```
122129
Note that this will still also create a commit, unless you specify `push: false`!
130+
131+
Alternatively, the SVG description of the diagram is available in the `svg` output,
132+
which you can refer to in your workflow as e.g. `${{ steps.make_diagram.outputs.svg }}`.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ inputs:
3131
description: "If given, the name of an artifact to be created containing the diagram. Default: don't create an artifact."
3232
required: false
3333
default: ''
34+
outputs:
35+
svg:
36+
description: "The diagram contents as text"
3437
runs:
3538
using: "node12"
3639
main: "index.js"

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,11 +1354,11 @@ var require_core = __commonJS({
13541354
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
13551355
}
13561356
exports2.getBooleanInput = getBooleanInput2;
1357-
function setOutput(name, value) {
1357+
function setOutput2(name, value) {
13581358
process.stdout.write(os2.EOL);
13591359
command_1.issueCommand("set-output", { name }, value);
13601360
}
1361-
exports2.setOutput = setOutput;
1361+
exports2.setOutput = setOutput2;
13621362
function setCommandEcho(enabled) {
13631363
command_1.issue("echo", enabled ? "on" : "off");
13641364
}
@@ -1717,11 +1717,11 @@ var require_core2 = __commonJS({
17171717
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
17181718
}
17191719
exports2.getBooleanInput = getBooleanInput2;
1720-
function setOutput(name, value) {
1720+
function setOutput2(name, value) {
17211721
process.stdout.write(os2.EOL);
17221722
command_1.issueCommand("set-output", { name }, value);
17231723
}
1724-
exports2.setOutput = setOutput;
1724+
exports2.setOutput = setOutput2;
17251725
function setCommandEcho(enabled) {
17261726
command_1.issue("echo", enabled ? "on" : "off");
17271727
}
@@ -26278,6 +26278,7 @@ var main = async () => {
2627826278
colorEncoding
2627926279
}));
2628026280
const outputFile = core.getInput("output_file") || "./diagram.svg";
26281+
core.setOutput("svg", componentCodeString);
2628126282
await import_fs2.default.writeFileSync(outputFile, componentCodeString);
2628226283
let doesBranchExist = true;
2628326284
if (branch) {

src/index.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const main = async () => {
4343

4444
const outputFile = core.getInput("output_file") || "./diagram.svg"
4545

46+
core.setOutput('svg', componentCodeString)
47+
4648
await fs.writeFileSync(outputFile, componentCodeString)
4749

4850
let doesBranchExist = true

0 commit comments

Comments
 (0)
0