8000 Merge pull request #34 from ageorgou/allow-no-commit · githubocto/repo-visualizer@ccc127b · GitHub
[go: up one dir, main page]

Skip to content

Commit ccc127b

Browse files
author
Amelia Wattenberger
authored
Merge pull request #34 from ageorgou/allow-no-commit
Alternatives to committing
2 parents d754daa + d74d6b7 commit ccc127b

File tree

6 files changed

+5885
-50
lines changed

6 files changed

+5885
-50
lines changed

README.md

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ For a full demo, check out the [githubocto/repo-visualizer-demo](https://github.
88

99
## Inputs
1010

11-
## `output_file`
11+
### `output_file`
1212

1313
A path (relative to the root of your repo) to where you would like the diagram to live.
1414

1515
For example: images/diagram.svg
1616

1717
Default: diagram.svg
1818

19-
## `excluded_paths`
19+
### `excluded_paths`
2020

2121
A list of paths to folders to exclude from the diagram, separated by commas.
2222

2323
For example: dist,node_modules
2424

2525
Default: node_modules,bower_components,dist,out,build,eject,.next,.netlify,.yarn,.vscode,package-lock.json,yarn.lock
2626

27-
## `excluded_globs`
27+
### `excluded_globs`
2828

2929
A semicolon-delimited array of file [globs](https://globster.xyz/) to exclude from the diagram, using [micromatch](https://github.com/micromatch/micromatch) syntax. Provided as an array.
3030

@@ -38,32 +38,54 @@ excluded_globs: 'frontend/*.spec.js;**/*.{png,jpg};**/!(*.module).ts'
3838
# - '**/!(*.module).ts' # all TS files except module files
3939
```
4040

41-
## `root_path`
41+
### `root_path`
4242

4343
The directory (and its children) that you want to visualize in the diagram, relative to the repository root.
4444

4545
For example: `src/`
4646

4747
Default: `''` (current directory)
4848

49-
## `max_depth`
49+
### `max_depth`
5050

5151
The maximum number of nested folders to show files within. A higher number will take longer to render.
5252

5353
Default: 9
5454

55-
## `commit_message`
55+
### `should_push`
56+
57+
Whether to make a new commit with the diagram and push it to the original repository.
58+
59+
Should be a boolean value, i.e. `true` or `false`. See `commit_message` and `branch` for how to customise the commit.
60+
61+
Default: `true`
62+
63+
### `commit_message`
5664

5765
The commit message to use when updating the diagram. Useful for skipping CI. For example: `Updating diagram [skip ci]`
5866

5967
Default: `Repo visualizer: updated diagram`
6068

61-
## `branch`
69+
### `branch`
6270

6371
The branch name to push the diagram to (branch will be created if it does not yet exist).
6472

6573
For example: `diagram`
6674

75+
### `artifact_name`
76+
77+
The name of an [artifact](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts) to create containing the diagram.
78+
79+
If unspecified, no artifact will be created.
80+
81+
Default: `''` (no artifact)
82+
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+
6789
## Example usage
6890

6991
You'll need to run the `actions/checkout` Action beforehand, to check out the code.
@@ -77,3 +99,34 @@ You'll need to run the `actions/checkout` Action beforehand, to check out the co
7799
output_file: "images/diagram.svg"
78100
excluded_paths: "dist,node_modules"
79101
```
102+
103+
104+
## Accessing the diagram
105+
106+
By default, this action will create a new commit with the diagram on the specified branch.
107+
108+
If you want to avoid new commits, you can create an artifact to accompany the workflow run,
109+
by specifying an `artifact_name`. You can then download the diagram using the
110+
[`actions/download-artifact`](https://github.com/marketplace/actions/download-a-build-artifact)
111+
action from a later step in your workflow,
112+
or by using the [GitHub API](https://docs.github.com/en/rest/reference/actions#artifacts).
113+
114+
Example:
115+
```yaml
116+
- name: Update diagram
117+
id: make_diagram
118+
uses: githubocto/repo-visualizer@0.6.1
119+
with:
120+
output_file: "images/diagram.svg"
121+
artifact_name: my-diagram
122+
- name: Get artifact
123+
uses: actions/download-artifact@v2
124+
with:
125+
name: my-diagram
126+
path: downloads
127+
# Diagram now available at downloads/images/diagram.svg
128+
```
129+
Note that this will still also create a commit, unless you specify `should_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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ inputs:
2323
branch:
2424
description: "The branch name to push the diagram to (branch will be created if it does not yet exist). For example: diagram"
2525
required: false
26+
should_push:
27+
description: "Whether to push the new commit back to the repository. Must be true or false. Default: true"
28+
required: false
29+
default: true
30+
artifact_name:
31+
description: "If given, the name of an artifact to be created containing the diagram. Default: don't create an artifact."
32+
required: false
33+
default: ''
34+
outputs:
35+
svg:
36+
description: "The diagram contents as text"
2637
runs:
2738
using: "node12"
2839
main: "index.js"

0 commit comments

Comments
 (0)
0