From 85a22b43bf5bd81c557a17e191c5039379af0f7d Mon Sep 17 00:00:00 2001 From: Philipp Sauter Date: Wed, 31 Jul 2024 17:51:25 +0200 Subject: [PATCH] x/api: generate PR if API changes --- .github/workflows/generate_api.yaml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/generate_api.yaml diff --git a/.github/workflows/generate_api.yaml b/.github/workflows/generate_api.yaml new file mode 100644 index 00000000..bf6158f8 --- /dev/null +++ b/.github/workflows/generate_api.yaml @@ -0,0 +1,34 @@ +name: check_and_regenerate_api + +on: + workflow_dispatch: + schedule: + - cron: "0 7 * * *" # everyday at 7 AM + +jobs: + check_changes_and_create_pr: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check for changes + id: check_changes + run: | + make x-cmd + git diff --quiet || echo "changes_detected=true" >> $GITHUB_OUTPUT + + - name: Create PR + if: steps.check_changes.outputs.changes_detected + uses: peter-evans/create-pull-request@v6 + with: + title: "api: regenerate from new API spec" + body: "New changes have appeared in the API spec and the `exo api` commands have been regenerated." + branch: generate-exo-api + delete-branch: true + base: master