forked from maximhq/bifrost
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 1.74 KB
/
openapi-bundle.yml
File metadata and controls
65 lines (55 loc) · 1.74 KB
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
name: OpenAPI Bundle
on:
push:
branches: ["main"]
paths:
- ".github/workflows/openapi-bundle.yml"
- "docs/openapi/**"
- "!docs/openapi/openapi.json"
pull_request:
paths:
- "docs/openapi/**"
- "!docs/openapi/openapi.json"
permissions:
contents: write
jobs:
bundle-openapi:
name: Bundle OpenAPI Spec
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: block
allowed-endpoints: >
files.pythonhosted.org:443
github.com:443
pypi.org:443
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ secrets.GH_TOKEN }}
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.11"
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: pip install pyyaml
- name: Bundle OpenAPI spec
working-directory: ./docs/openapi
run: python bundle.py
- name: Commit and push changes
if: github.event_name == 'push'
run: |
CURRENT_BRANCH="${GITHUB_REF_NAME:-main}"
git add docs/openapi/openapi.json
if git diff --staged --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "chore: regenerate openapi.json --skip-ci"
git push origin "$CURRENT_BRANCH"