diff --git a/.github/workflows/update-openapi.yml b/.github/workflows/update-openapi.yml new file mode 100644 index 00000000000..191b49d736a --- /dev/null +++ b/.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