/
githubmirror
/
grafana
Обзор
Документация
Войти
/
githubmirror
/
grafana
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/backend-code-checks.yml
115 строк
4 KB
Konstantin
chore: Cancel running actions when superseded by newer commits (#129707)
31 июл 2026, 11:53
Не верифицирован
31 июл 2026, 11:53
05c572a
Код
Авторство
О чём код?
name: Backend Code Checks on: pull_request: paths-ignore: - '*.md' - 'docs/**' - 'latest.json' push: branches: - main paths-ignore: - '*.md' - 'docs/**' - 'latest.json' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: detect-changes: # Run on `grafana/grafana` pushes, or on pull requests, to prevent double-running on mirrors if: (github.event_name == 'pull_request' || (github.event_name == 'push' && github.repository == 'grafana/grafana')) name: Detect whether code changed runs-on: ubuntu-arm64-small permissions: contents: read outputs: changed: ${{ steps.detect-changes.outputs.backend }} steps: - uses: actions/checkout@v5 with: persist-credentials: true # required to get more history in the changed-files action fetch-depth: 0 filter: blob:none - name: Detect changes id: detect-changes uses: ./.github/actions/change-detection with: self: .github/workflows/backend-code-checks.yml validate-configs: permissions: contents: read id-token: write needs: detect-changes if: needs.detect-changes.outputs.changed == 'true' name: Validate Backend Configs runs-on: ubuntu-x64 steps: - uses: actions/checkout@v5 with: persist-credentials: false - name: Setup Go uses: ./.github/actions/setup-go with: cache-build: 'false' - name: Verify CUE formatting run: | make fix-cue if [ -n "$(git diff --name-only)" ]; then echo "CUE files are not formatted. Please run 'make fix-cue' and commit the changes." git diff --name-only exit 1 fi - name: Verify code generation run: | CODEGEN_VERIFY=1 make gen-cue CODEGEN_VERIFY=1 make gen-jsonnet CODEGEN_VERIFY=1 make gen-apps CODEGEN_VERIFY=1 make gen-app-manifests-unistore - name: Validate go.mod run: go run scripts/modowners/modowners.go check go.mod # Enterprise setup is needed for complete OpenAPI spec generation # We only do this for internal PRs - name: Get GitHub App token if: github.event.pull_request.head.repo.fork == false id: get-github-app-token uses: grafana/shared-workflows/actions/create-github-app-token@259ba21cb3ff07724f331e26d926d655d24b317b # create-github-app-token/v0.2.3 with: github_app: grafana-ci-bot - name: Setup Grafana Enterprise if: github.event.pull_request.head.repo.fork == false uses: ./.github/actions/setup-enterprise with: token: ${{ steps.get-github-app-token.outputs.token }} - name: Generate and Validate OpenAPI Specs run: | # For PRs from forks, we'll just run the basic swagger-gen without validation if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.fork }}" == "true" ]]; then echo "PR is from a fork, skipping enterprise-based validation" make swagger-gen exit 0 fi # Clean and regenerate OpenAPI specs make swagger-clean && make openapi3-gen # Check if the generated specs differ from what's in the repository for f in public/api-merged.json public/openapi3.json public/api-enterprise-spec.json; do git add $f; done if [ -z "$(git diff --name-only --cached)" ]; then echo "OpenAPI specs are up to date!" else echo "OpenAPI specs are OUT OF DATE!" git diff --cached echo "Please ensure the branch is up-to-date, then regenerate the specification by running make swagger-clean && make openapi3-gen" exit 1 fi