-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (58 loc) · 2.09 KB
/
Copy pathopenapi.yml
File metadata and controls
60 lines (58 loc) · 2.09 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
name: Checks that OpenAPI specs are up to date
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 1"
jobs:
check-openapi-spec-up-to-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make download
- uses: tj-actions/verify-changed-files@v20
id: verify-changed-openapi-specs
with:
files: incident_io_openapi.json
- uses: actions/setup-python@v5
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
with:
python-version: "3.10"
- name: Cache Pip
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
uses: actions/cache@v5
with:
path: |
~/.cache/pip
key: ${{ runner.os }}-3.10-${{ hashFiles('**/poetry.lock') }}
- name: Install Poetry
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
run: |
pip install poetry
- name: Install dependencies
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
run: |
poetry install
- name: Generate client
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
run: |
make generate
- name: Create new branch
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
run: |
branch_name=update_api_$(date "+%Y_%m_%d")
commit_message="feat: Updated API at $(date "+%Y-%m-%d")"
git config user.email "github-actions@githhub.com"
git config user.name "Github Actions"
git checkout -b $branch_name
git add \
docs \
incident_io_client \
incident_io_openapi.json
git commit -m "$commit_message"
git push -u origin $branch_name
- name: Create new Pull Request
if: steps.verify-changed-openapi-specs.outputs.files_changed == 'true'
run: |
gh pr create --body "" --title "Updated API at $(date "+%Y-%m-%d")"
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}