Skip to content
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

Automatically update OpenAPI descriptions and generated code #2985

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/update-openapi.yml
@@ -0,0 +1,45 @@
on:
workflow_dispatch: { }
schedule:
- cron: "23 15 * * *"
name: update-openapi
jobs:
update-openapi:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.x
cache-dependency-path: "**/go.sum"
- id: update
name: update
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
script/metadata.sh update-openapi
if git diff --quiet openapi_operations.yaml; then
echo "No changes to openapi_operations.yaml"
exit 0
fi
if script/generate.sh --check >/dev/null 2>&1; then
echo "No changes to generated code"
exit 0
fi
script/generate.sh
echo "UPDATED=1" >> $GITHUB_OUTPUT
- name: create PR
if: steps.update.outputs.UPDATED == '1'
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 #v5.0.2
with:
token: ${{ github.token }}
commit-message: "update openapi_operations.yaml and generated code"
title: "Update OpenAPI operations and generated code"
body: |
This PR was automatically generated by the update-openapi workflow in order to keep
the OpenAPI operations and generated code in sync with the latest changes to the
GitHub REST API.
delete-branch: true