-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.35 KB
/
doc.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
name: Documentation
on:
push:
branches:
- main
paths:
- 'docs/swagger.yaml'
pull_request:
branches:
- main
paths:
- 'docs/swagger.yaml'
jobs:
documentation:
name: Generate documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: '1.17.7'
- name: Install dependencies
run: |
go install github.com/go-swagger/go-swagger/cmd/swagger@latest
- name: Validate swagger specification
run: make validate
- name: Generate markdown documentation
run: make markdown
- name: Commit files
id: commit
run: |
git pull
git add docs/swagger.md
if [[ -z "$(git status --porcelain)" ]]; then
echo "::set-output name=push::false"
else
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git commit -m "update docs: auto-commit to update markdown from github-actions"
echo "::set-output name=push::true"
fi
- name: Push changes
if: steps.commit.outputs.push == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}