Skip to content

Commit 38b2a30

Browse files
committed
Finalize first version of action
1 parent d2e0cd2 commit 38b2a30

16 files changed

+448
-73
lines changed

.github/workflows/build.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build action
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs:
9+
Build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Set Node.JS
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 16.x
19+
20+
- name: npm install
21+
run: npm install
22+
23+
- name: Build
24+
run: npm run build
25+
26+
- name: Run tests
27+
run: npm run test
28+
29+
- name: Run Prettier
30+
run: npm run format-check
31+
32+
- name: Lint
33+
run: npm run lint
34+
35+
- name: Compare the expected and actual dist directories
36+
run: |
37+
if [ "$(git diff --ignore-space-at-eol ${{inputs.folder-path}} | wc -l)" -gt "0" ]; then
38+
echo "Detected uncommitted changes after the build. See the status below:"
39+
git diff
40+
exit 1
41+
fi

.github/workflows/manual.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Manual trigger action
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
root-issue-url:
6+
description: 'Root issue url'
7+
required: true
8+
type: string
9+
section-title:
10+
description: 'Section title'
11+
required: true
12+
type: string
13+
include-legend:
14+
description: 'Include legend'
15+
type: boolean
16+
include-finish-node:
17+
description: 'Include finish node'
18+
type: boolean
19+
dry-run:
20+
description: 'Dry run'
21+
type: boolean
22+
23+
jobs:
24+
run:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- uses: ./
31+
name: 'Build issues dependency graph'
32+
id: build-issue-dependencies-graph
33+
with:
34+
root-issue-url: '${{ github.event.inputs.root-issue-url }}'
35+
section-title: '${{ github.event.inputs.section-title }}'
36+
github-token: '${{ secrets.GITHUB_TOKEN }}'
37+
include-legend: '${{ github.event.inputs.include-legend }}'
38+
include-finish-node: '${{ github.event.inputs.include-finish-node }}'
39+
dry-run: '${{ github.event.inputs.dry-run }}'

.github/workflows/schedule.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
on:
2+
schedule:
3+
- cron: '*/5 * * * *' # Twice per day
4+
5+
jobs:
6+
run:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- root-issue-url: 'https://github.com/owner/repo/issues/1'
13+
section-title: 'Spec Diagram'
14+
- root-issue-url: 'https://github.com/owner/repo/issues/2'
15+
section-title: 'Spec Diagram'
16+
steps:
17+
- uses: maxim-lobanov/build-issue-dependencies-graph@v1
18+
name: 'Build issues dependency graph'
19+
id: build-issue-dependencies-graph
20+
with:
21+
root-issue-url: '${{ github.event.inputs.root-issue-url }}'
22+
section-title: '${{ github.event.inputs.section-title }}'
23+
github-token: '${{ secrets.GITHUB_TOKEN }}'
24+
include-legend: true
25+
include-finish-node: true

README.md

+180-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,180 @@
1-
# build-issue-dependencies-graph
1+
# maxim-lobanov/build-issue-dependencies-graph
2+
3+
This action is intended for building dependencies graph between issues in epic, rendering mermaid diagram with this graph and automatically updating epic issue body with diagram.
4+
It can be useful during work on big epics where it is tricky to keep all dependencies in mind.
5+
6+
## Parameters
7+
| Parameter | Description |
8+
|-|-|
9+
| `root-issue-url` | Url of the root issue |
10+
| `section-title` | Title of markdown section where mermaid chart should be placed |
11+
| `github-token` | GitHub API Token with read and write access to root issue and read access to all issues in the tasklist |
12+
| `include-legend` | Set this option to include legend to mermaid diagram |
13+
| `include-finish-node` | Set this option to include finish node to mermaid diagram |
14+
| `dry-run` | Set this option to not update root issue with updated mermaid diagram and only print new diagram to output |
15+
16+
## Usage
17+
18+
1. Update root issue body to include task list with all children issues:
19+
```
20+
- [ ] https://github.com/owner/repo/issues/2
21+
- [ ] https://github.com/owner/repo/issues/3
22+
- [ ] https://github.com/owner/repo/issues/4
23+
...
24+
```
25+
2. Create an empty section in root issue body to which mermaid diagram will be inserted:
26+
```
27+
...
28+
## Spec Diagram
29+
...
30+
```
31+
3. Update all children issues to define their dependencies in issues body using one of the following syntax:
32+
```
33+
Depends on https://github.com/owner/repo/issues/2, https://github.com/owner/repo/issues/3
34+
Depends on: https://github.com/owner/repo/issues/2 https://github.com/owner/repo/issues/3
35+
Dependencies: https://github.com/owner/repo/issues/2, https://github.com/owner/repo/issues/3
36+
```
37+
Any of the format above can be used one or multiple times in issue body. Any separator can be used for issues in line.
38+
39+
4. Add workflow to invoke this action:
40+
```yml
41+
jobs:
42+
update-diagram:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: maxim-lobanov/build-issue-dependencies-graph@v1
46+
with:
47+
root-issue-url: 'https://github.com/owner/repo/issues/1'
48+
section-title: 'Spec Diagram'
49+
github-token: '${{ secrets.GITHUB_TOKEN }}'
50+
include-legend: true
51+
include-finish-node: true
52+
```
53+
54+
## Advanced usage
55+
56+
### Workflow to trigger action manually
57+
```yml
58+
on:
59+
workflow_dispatch:
60+
inputs:
61+
root-issue-url:
62+
description: 'Root issue url'
63+
required: true
64+
type: string
65+
section-title:
66+
description: 'Section title'
67+
required: true
68+
type: string
69+
include-legend:
70+
description: 'Include legend'
71+
type: boolean
72+
include-finish-node:
73+
description: 'Include finish node'
74+
type: boolean
75+
dry-run:
76+
description: 'Dry run'
77+
type: boolean
78+
79+
jobs:
80+
run:
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: maxim-lobanov/build-issue-dependencies-graph@v1
84+
name: 'Build issues dependency graph'
85+
id: build-issue-dependencies-graph
86+
with:
87+
root-issue-url: '${{ github.event.inputs.root-issue-url }}'
88+
section-title: '${{ github.event.inputs.section-title }}'
89+
github-token: '${{ secrets.GITHUB_TOKEN }}'
90+
include-legend: '${{ github.event.inputs.include-legend }}'
91+
include-finish-node: '${{ github.event.inputs.include-finish-node }}'
92+
dry-run: '${{ github.event.inputs.dry-run }}'
93+
```
94+
95+
### Workflow to trigger action on schedule
96+
```
97+
on:
98+
schedule:
99+
- cron: '* */12 * * *' # Twice per day
100+
101+
jobs:
102+
run:
103+
runs-on: ubuntu-latest
104+
strategy:
105+
fail-fast: false
106+
matrix:
107+
include:
108+
- root-issue-url: 'https://github.com/owner/repo/issues/1'
109+
section-title: 'Spec Diagram'
110+
- root-issue-url: 'https://github.com/owner/repo/issues/2'
111+
section-title: 'Spec Diagram'
112+
steps:
113+
- uses: maxim-lobanov/build-issue-dependencies-graph@v1
114+
name: 'Build issues dependency graph'
115+
id: build-issue-dependencies-graph
116+
with:
117+
root-issue-url: '${{ github.event.inputs.root-issue-url }}'
118+
section-title: '${{ github.event.inputs.section-title }}'
119+
github-token: '${{ secrets.GITHUB_TOKEN }}'
120+
include-legend: true
121+
include-finish-node: true
122+
```
123+
124+
125+
## Mermaid examples
126+
127+
```mermaid
128+
flowchart TD
129+
130+
%% <Legend>
131+
legend --> start
132+
subgraph legend["Legend"]
133+
direction LR;
134+
notstarted("Issue is not started"):::notstarted;
135+
started("Issue is in progress"):::started;
136+
completed("Issue is done"):::completed;
137+
notstarted --> started --> completed;
138+
end
139+
140+
%% </Legend>
141+
142+
143+
%% <CSS>
144+
145+
classDef notstarted fill:#FFF,color:#000;
146+
classDef started fill:#fae17d,color:#000;
147+
classDef completed fill:#ccffd8,color:#000;
148+
149+
%% </CSS>
150+
151+
152+
%% <Issues>
153+
154+
start("Start"):::notstarted;
155+
156+
issue1488484564("[TEST ISSUE] Child issue 1"):::completed;
157+
click issue1488484564 href "https://github.com/maxim-lobanov/build-issue-dependencies-graph/issues/2" _blank;
158+
159+
issue1488484695("[TEST ISSUE] Child issue 2"):::completed;
160+
click issue1488484695 href "https://github.com/maxim-lobanov/build-issue-dependencies-graph/issues/3" _blank;
161+
162+
issue1488484833("[TEST ISSUE] Child issue 3"):::notstarted;
163+
click issue1488484833 href "https://github.com/maxim-lobanov/build-issue-dependencies-graph/issues/4" _blank;
164+
165+
finish("Finish"):::notstarted;
166+
167+
%% </Issues>
168+
169+
170+
%% <Dependencies>
171+
172+
start --> issue1488484564;
173+
start --> issue1488484695;
174+
issue1488484564 --> issue1488484833;
175+
issue1488484695 --> issue1488484833;
176+
issue1488484833 --> finish;
177+
178+
%% </Dependencies>
179+
180+
```

action.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,26 @@ author: 'Maksim Lobanov'
33
description: 'Update epic issue with mermaid diagram that contains dependencies between all issues included to epic'
44
inputs:
55
root-issue-url:
6-
description: 'Url of root issue'
7-
required: true
8-
access-token:
9-
description: 'GitHub API Token with read and write access to root issue and read access to all tasklist issues'
6+
description: 'Url of the root issue'
107
required: true
118
section-title:
12-
description: 'Title of markdown header where mermaid chart should be placed'
9+
description: 'Title of markdown section where mermaid chart should be placed'
10+
required: true
11+
github-token:
12+
description: 'GitHub API Token with read and write access to root issue and read access to all issues in the tasklist'
1313
required: true
14-
includeLegend:
14+
include-legend:
1515
description: 'Set this option to include legend to mermaid diagram'
1616
required: false
17-
dryRun:
17+
default: 'false'
18+
include-finish-node:
19+
description: 'Set this option to include finish node to mermaid diagram'
20+
required: false
21+
default: 'false'
22+
dry-run:
1823
description: 'Set this option to not update root issue with updated mermaid diagram and only print new diagram to output'
1924
required: false
25+
default: 'false'
2026
runs:
2127
using: 'node16'
2228
main: 'dist/index.js'

0 commit comments

Comments
 (0)