-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
56 lines (55 loc) · 1.87 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Generate a DB diagram
description: A GitHub action generating Mermaid-Js ERD diagrams from existing DB tables.
inputs:
mermerd-tarball-url:
description: URL to download mermerd executable from
default: https://github.com/KarnerTh/mermerd/releases/download/v0.4.1/mermerd_0.4.1_linux_amd64.tar.gz
run-config:
description: The path to a run config file (YAML). If provided connection-string option is ignored.
default: ''
connection-string:
description: Connection string for the DB
default: ''
schema:
description: Schema that should be used
default: public
tables:
description: Tables to include
default: ''
output-filename:
description: Output file name
default: result.mmd
runs:
using: composite
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch mermerd
shell: bash
run: |
wget -qO- ${{ inputs.mermerd-tarball-url }} | \
tar -xvzf - mermerd
- name: Run mermerd with a run config
if: ${{ inputs.run-config != '' }}
shell: bash
run: ./mermerd
- name: Run mermerd with connection-string CLI parameter
if: ${{ inputs.run-config == '' }}
shell: bash
run: |
./mermerd \
--connectionString ${{ inputs.connection-string }} \
--outputFileName ${{ inputs.output-filename }} \
--schema ${{ inputs.schema }} \
${{ inputs.tables != '' && format('--selectedTables {0}', inputs.tables) || '--useAllTables' }} \
--debug
- name: Prepare git config, commit changes and push
shell: bash
run: |
git config --global user.name "GitHubActions"
git config --global user.email "<>"
npm config set git-tag-version false
git add ${{ inputs.output-filename }}
git commit -m "Update DB diagram"
git push origin $(git branch --show-current)