fix: reduce false positives #173
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Metadata lint | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| permissions: {} | |
| jobs: | |
| detect-changes: | |
| name: Detect whether code changed | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| docs: ${{ steps.detect-changes.outputs.docs }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| with: | |
| persist-credentials: true # required to get more history in the changed-files action | |
| fetch-depth: 2 | |
| - name: Detect changes | |
| id: detect-changes | |
| uses: ./.github/actions/change-detection | |
| with: | |
| self: .github/workflows/metadata-lint.yml | |
| lint-metadata: | |
| needs: detect-changes | |
| runs-on: ubuntu-x64 | |
| if: github.event_name == 'pull_request' && needs.detect-changes.outputs.docs == 'true' | |
| name: Verify metadata.md is up to date with plugin.schema.json | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| NX_BRANCH: ${{ github.event.number || github.ref_name }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| # We need to fetch all branches and commits so that Nx affected has a base to compare against. | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup nodejs | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version-file: '.nvmrc' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --no-audit | |
| - name: Sync metadata.md | |
| run: npm -w website run prebuild | |
| - name: Verify metadata.md | |
| run: | | |
| error_message="ERROR! metadata.md is out of sync with Grafanas plugin.schema.json. Please run 'npm -w website run prebuild', commit the changes and push again." | |
| file_diff="$(git diff --name-only)" | |
| if [ -n "$file_diff" ]; then | |
| echo "$file_diff" | |
| echo "${error_message}" | |
| exit 1 | |
| fi |