-
Notifications
You must be signed in to change notification settings - Fork 51
109 lines (95 loc) · 3.29 KB
/
make-swagger.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Apply make swagger
on:
push:
branches:
- main
paths:
- 'src/core/**/**.go'
- 'src/api/rest/server/**/**.go'
jobs:
update-swagger-doc:
name: Update Swagger doc
if: github.repository == 'cloud-barista/cb-tumblebug'
# This job runs on Ubuntu-latest (Ubuntu 20.04 LTS checked on 2022-09-06)
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.23.0' ]
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout source code
uses: actions/checkout@v4
- name: Install swag
run: |
go install github.com/swaggo/swag/cmd/swag@latest
- name: Update Swagger doc
run: |
cd src/
make swag
# - name: Commit generated Swagger docs
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# file_pattern: src/api/rest/docs/**
# commit_message: Update Swagger docs
- name: Force-Add Swagger doc files
run: |
cd src/api/rest/docs/
git add -f -v docs.go swagger.json swagger.yaml
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.UPDATE_SWAGGER_DOC_PAT }}
commit-message: Update Swagger REST API doc
committer: cb-bot <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: update-swagger-doc
base: main
delete-branch: true
title: '[Workflow] Update Swagger REST API doc'
body: |
Update Swagger REST API doc
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
swagger
automated pr
assignees: cloud-barista/cb-tumblebug-maintainer
reviewers: cloud-barista/cb-tumblebug-maintainer
team-reviewers: |
owners
maintainers
draft: false
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.create-pull-request.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pull-request.outputs.pull-request-url }}"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"