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