Skip to content

ci: Add github action to update openapi.json #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/update_openapi_json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Update openapi.json using openapi.yaml and commit result

on:
pull_request:
branches: [ "main" ]

jobs:
run_conversion:
name: Run convert_to_json.py script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
cd python
python -m pip install --upgrade pip
python -m pip install poetry
poetry install
poetry run convert_to_json ../openapi.yaml ../openapi.json

- name: Commit result
uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
commit_message: Update openapi.json to match openapi.yaml
file_pattern: openapi.json

- if: steps.auto-commit-action.outputs.changes_detected == 'true'
run: echo "Update openapi.json"

- if: steps.auto-commit-action.outputs.changes_detected == 'false'
run: echo "openapi.json is already up to date"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
*.pyc
File renamed without changes.
8 changes: 4 additions & 4 deletions scripts/pyproject.toml → python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[tool.poetry]
name = "deepl_openapi"
name = "scripts"
package-mode = false
description = "DeepL OpenAPI specification and associated scripts"
version = "0.1.0"
authors = ["DeepL SE <[email protected]>"]
license = "MIT"
readme = "README.md"

[tool.poetry.scripts]
convert_to_json = "scripts.convert_to_json:main"

[tool.poetry.dependencies]
python = ">=3.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@click.command(
"convert_to_json",
help="Convert OpenAPI YAML to JSON (using std-in and std-out)",
help="Convert OpenAPI YAML to JSON ",
)
@click.argument("input")
@click.argument("output")
Expand Down