From dfb040d8427fc629df9c17b9a19de714cda8274b Mon Sep 17 00:00:00 2001 From: William Wernert Date: Thu, 20 Jul 2023 15:31:20 -0400 Subject: [PATCH] CI: Add GitHub workflow to schedule a PR with changes to Alerting Swagger spec (#71794) * add github workflow to schedule alerting swagger spec pr * also generate stable api spec --- .github/CODEOWNERS | 1 + .github/workflows/alerting-swagger-gen.yml | 37 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/alerting-swagger-gen.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e5c05380da1..84984af17e4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -594,6 +594,7 @@ embed.go @grafana/grafana-as-code /.github/pr-commands.json @marefr /.github/renovate.json5 @grafana/frontend-ops /.github/teams.yml @armandgrillet +/.github/workflows/alerting-swagger-gen.yml @grafana/alerting-backend-product /.github/workflows/auto-milestone.yml @grafana/grafana-delivery /.github/workflows/backport.yml @grafana/grafana-delivery /.github/workflows/bump-version.yml @grafana/grafana-delivery diff --git a/.github/workflows/alerting-swagger-gen.yml b/.github/workflows/alerting-swagger-gen.yml new file mode 100644 index 00000000000..3eaffa50b44 --- /dev/null +++ b/.github/workflows/alerting-swagger-gen.yml @@ -0,0 +1,37 @@ +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * 1' + +jobs: + gen-swagger: + name: Alerting Swagger spec generation cron job + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Set go version + uses: actions/setup-go@v4 + with: + go-version: '1.20.6' + - name: Build swagger + run: | + make -C pkg/services/ngalert/api/tooling post.json api.json + - name: Open Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: update alerting swagger spec" + title: "Alerting: Update Swagger spec" + body: | + This is an automated pull request to update the alerting swagger spec. + Please review and merge. + branch: update-alerting-swagger-spec + delete-branch: true + labels: 'area/alerting,type/docs,no-backport,no-changelog' + team-reviewers: 'grafana/alerting-backend-product' + draft: false +