-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
87 lines (72 loc) · 2.48 KB
/
action.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: 'C4(DSL) render to Github markdown'
description: 'Render C4 diagram to Github markdown'
branding:
icon: 'codesandbox'
color: 'orange'
inputs:
filename:
description: 'Diagram file name'
required: true
github-branch:
description: 'Github branch name to commit rendered diagrams'
default: ${{ github.ref }}
github-token:
description: "Github token to access target repository"
default: ${{ github.token }}
github-repo:
description: >
Target repository with owner in form of `some-org/repo`
default: ${{ github.repository }}
path:
description: 'Relative path in target repository to place the rendered MD files'
default: './'
github-username:
description: "Username of a user that will make a commit`"
default: C4RenderBot
github-user-mail:
description: "Email of a user that will make a commit`"
default: 'github-bot@${{ github.repository_owner }}.com'
target-clone-dir:
default: target-repo-clone
structurizr-image-tag:
description: Specific image tag of `structurizr/cli` docker image
default: latest
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ inputs.github-repo }}
path: ${{ inputs.target-clone-dir }}
ref: ${{ inputs.github-branch }}
token: ${{ inputs.github-token }}
- name: Render Diagrams
env:
FILE_NAME: ${{ inputs.filename }}
TARGET_PATH: ${{ inputs.target-clone-dir }}/${{ inputs.path }}
TAG: ${{ inputs.structurizr-image-tag }}
run: |
mkdir -p $TARGET_PATH/mermaid
docker run --rm -v $PWD:/usr/local/structurizr structurizr/cli:$TAG export -f mermaid -w $FILE_NAME -o $TARGET_PATH/mermaid
echo "of mermaid files"
ls $TARGET_PATH/mermaid
${{ github.action_path }}/run.sh
shell: bash
# - name: Render Markdown
# shell: bash
# working-directory:
# run:
- name: commit
shell: bash
env:
GITHUB_USERNAME: ${{ inputs.github-username }}
GITHUB_USER_EMAIL: ${{ inputs.github-user-mail }}
run: |
set -e
cd ${{ inputs.target-clone-dir }}/${{ inputs.path }}
git config --global user.email $GITHUB_USERNAME
git config --global user.name $GITHUB_USER_EMAIL
git add .
git commit -m"Diagram files [ci skip]"
git push