-
Notifications
You must be signed in to change notification settings - Fork 23
61 lines (52 loc) · 1.94 KB
/
generate-openapi-spec.yml
File metadata and controls
61 lines (52 loc) · 1.94 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
name: "Manual : Generate OpenAPI spec"
on:
workflow_dispatch:
jobs:
generate-openapi-spec:
env:
PDM_DEPS: 'urllib3<2'
defaults:
run:
working-directory: ./datajunction-server
runs-on: ubuntu-latest
name: OpenAPI Spec
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 19
- name: Install DJ
run: |
python -m pip install --upgrade pip
pip install .
- name: Generate OpenAPI Spec
run: |
./scripts/generate-openapi.py -o ../openapi.json
- name: Generate Markdown Docs from Spec
run: |
npm install -g widdershins
widdershins ../openapi.json -o ../docs/content/0.1.0/docs/developers/the-datajunction-api-specification.md --code=true --omitBody=true --summary=true
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Set short sha
id: sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Commit OpenAPI Spec
run: |
git add ../openapi.json
git add ../docs/content/0.1.0/docs/developers/the-datajunction-api-specification.md
git commit -m "Updating OpenAPI Spec"
git checkout -b ci-pr/python-client-${{ steps.sha.outputs.short_sha }}
git push --set-upstream origin ci-pr/python-client-${{ steps.sha.outputs.short_sha }}
- name: Open a PR
run: gh pr create -B main -H ci-pr/python-client-${{ steps.sha.outputs.short_sha }} --title 'Update OpenAPI Spec - ${{ steps.sha.outputs.short_sha }}' --body '(This PR was generated by a GitHub action)'
env:
GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}