Chore: Readd api client verification and update clients (#109847)

* add api client verification to lint step

* separate steps, clearer error messages

* make same change to non-enterprise version

* double-quote

* ignore conf

* update generated apis

* add names for steps

* fix comment
This commit is contained in:
Ashley Harrison 2025-08-20 13:54:51 +01:00 committed by GitHub
parent 5ec1b4198c
commit af1b6dd171
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 67 additions and 0 deletions

View File

@ -139,3 +139,70 @@ jobs:
cache-dependency-path: 'yarn.lock'
- run: yarn install --immutable --check-cache
- run: yarn run betterer:ci
lint-frontend-api-clients:
permissions:
contents: read
id-token: write
# Run this workflow only for PRs from forks; if it gets merged into `main` or `release-*`,
# the `lint-frontend-api-clients-enterprise` workflow will run instead
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true
name: Verify API clients
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- run: yarn install --immutable --check-cache
- name: Generate API clients
run: |
extract_error_message='ERROR! API client generation failed!'
yarn generate-apis || (echo "${extract_error_message}" && false)
- name: Verify generated clients
run: |
uncommited_error_message="ERROR! API client generation has not been committed. Please run 'yarn generate-apis', commit the changes and push again."
file_diff="$(git diff ':!conf')"
if [ -n "$file_diff" ]; then
echo "$file_diff"
echo "${uncommited_error_message}"
exit 1
fi
lint-frontend-api-clients-enterprise:
permissions:
contents: read
id-token: write
# Run this workflow for non-PR events (like pushes to `main` or `release-*`) OR for internal PRs (PRs not from forks)
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false
name: Verify API clients (enterprise)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
- name: Setup Enterprise
uses: ./.github/actions/setup-enterprise
with:
github-app-name: 'grafana-ci-bot'
- run: yarn install --immutable --check-cache
- name: Generate API clients
run: |
extract_error_message='ERROR! API client generation failed!'
yarn generate-apis || (echo "${extract_error_message}" && false)
- name: Verify generated clients
run: |
uncommited_error_message="ERROR! API client generation has not been committed. Please run 'yarn generate-apis', commit the changes and push again."
file_diff="$(git diff ':!conf')"
if [ -n "$file_diff" ]; then
echo "$file_diff"
echo "${uncommited_error_message}"
exit 1
fi