update-openapi #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
# set NEEDS_PR output to 1 | |
echo "UPDATED=1" >> $GITHUB_OUTPUT | |
- name: create PR | |
uses: peter-evans/[email protected] | |
if: steps.update.outputs.UPDATED == '1' | |
with: | |
token: ${{ github.token }} | |
commit-message: "Update openapi_operations.yaml" | |
title: "Update OpenAPI operations and generated code" | |
body: | | |
This PR was automatically generated by the update-openapi workflow. | |
Please review the changes and merge if they look good. | |
branch: "auto-update-openapi" | |
delete-branch: true |