File tree 1 file changed +95
-0
lines changed
1 file changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ help ()
6
+ {
7
+ # Display Help
8
+ echo " Syntax: script/start [-i|-s|-t|-p]"
9
+ echo " options:"
10
+ echo " -i|--issue Root issue url."
11
+ echo " -s|--section Section name to update."
12
+ echo " -t|--token GitHub token."
13
+ echo " -p|--publish Update root issue with new mermaid chart."
14
+ echo
15
+ echo " Examples:"
16
+ echo " script/start -issue 'https://github.com/maxim-lobanov/build-issue-dependencies-graph/issues/1' --token 'fake' --section 'Spec'"
17
+ echo " script/start -issue 'https://github.com/maxim-lobanov/build-issue-dependencies-graph/issues/1' --token 'fake' --section 'Spec' --publish"
18
+ echo
19
+ }
20
+
21
+
22
+ ROOT_ISSUE=" "
23
+ SECTION=" "
24
+ TOKEN=" "
25
+ INCLUDE_LEGEND=" true"
26
+ INCLUDE_FINISH_NODE=" true"
27
+ DRY_RUN=" true"
28
+
29
+ while [[ $# -gt 0 ]]; do
30
+ case $1 in
31
+ -i|--issue)
32
+ ROOT_ISSUE=" $2 "
33
+ shift # past argument
34
+ shift # past value
35
+ ;;
36
+ -s|--section)
37
+ SECTION=" $2 "
38
+ shift # past argument
39
+ shift # past value
40
+ ;;
41
+ -t|--token)
42
+ TOKEN=" $2 "
43
+ shift # past argument
44
+ shift # past value
45
+ ;;
46
+ -p|--publish)
47
+ DRY_RUN=" false"
48
+ shift # past argument
49
+ ;;
50
+ -h|--help)
51
+ help
52
+ exit 0
53
+ ;;
54
+ -* |--* )
55
+ echo " Unknown option $1 "
56
+ exit 1
57
+ ;;
58
+ esac
59
+ done
60
+
61
+ if [ -z " $ROOT_ISSUE " ]; then
62
+ echo ' Error: Mandatory argument "--issue" is missed'
63
+ echo
64
+ help
65
+ exit 1
66
+ fi
67
+
68
+ if [ -z " $TOKEN " ]; then
69
+ echo ' Error: Mandatory argument "--token" is missed'
70
+ echo
71
+ help
72
+ exit 1
73
+ fi
74
+
75
+ if [ -z " $SECTION " ]; then
76
+ echo ' Error: Mandatory argument "--section" is missed'
77
+ echo
78
+ help
79
+ exit 1
80
+ fi
81
+
82
+ if ! command -v ts-node & > /dev/null
83
+ then
84
+ echo " Installing ts-node..."
85
+ npm install -g ts-node
86
+ fi
87
+
88
+ env \
89
+ " INPUT_ROOT-ISSUE-URL=$ROOT_ISSUE " \
90
+ " INPUT_SECTION-TITLE=$SECTION " \
91
+ " INPUT_GITHUB-TOKEN=$TOKEN " \
92
+ " INPUT_INCLUDE-LEGEND=$INCLUDE_LEGEND " \
93
+ " INPUT_INCLUDE-FINISH-NODE=$INCLUDE_FINISH_NODE " \
94
+ " INPUT_DRY-RUN=$DRY_RUN " \
95
+ ts-node src/main.ts
You can’t perform that action at this time.
0 commit comments