Skip to content

PMM-7 Make AGENTS.md guidance reach Claude Code #960

PMM-7 Make AGENTS.md guidance reach Claude Code

PMM-7 Make AGENTS.md guidance reach Claude Code #960

Workflow file for this run

---
name: Dashboards
on:
pull_request:
paths:
- "dashboards/**"
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install NodeJS
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: "yarn"
cache-dependency-path: dashboards/pmm-app/yarn.lock
- name: Verify plugin.json dashboard paths exist
run: |
missing=$(jq -r '.includes[] | select(.path) | .path' dashboards/pmm-app/src/plugin.json \
| while read -r p; do [ -f "dashboards/$p" ] || echo "$p"; done)
if [ -n "$missing" ]; then
echo "::error::plugin.json references dashboard files that do not exist:"
echo "$missing" | sed 's/^/ - /'
exit 1
fi
- name: Install deps
run: make -C dashboards install
- name: Build Grafana Dashboards
run: make -C dashboards build
- name: Upload the build artefacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-dist
path: dashboards/pmm-app/dist/
if-no-files-found: error
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install NodeJS
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: "22"
cache: "yarn"
cache-dependency-path: dashboards/pmm-app/yarn.lock
- name: Install deps
run: make -C dashboards install
- name: Run lint
run: cd dashboards/pmm-app && yarn lint:check
- name: Run unit tests
run: cd dashboards/pmm-app && yarn test:ci
- name: Upload unit test coverage
if: github.event.pull_request.head.repo.full_name == github.repository
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
fail_ci_if_error: true
flags: unittests # optional
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Get changed dashboard files
id: changed
run: |
git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD \
| grep -E '^dashboards/dashboards/.*\.json$' \
| sort -u > changed_dashboards.txt || true
echo "count=$(wc -l < changed_dashboards.txt | tr -d ' ')" >> $GITHUB_OUTPUT
- name: Run cleanup check per dashboard
if: steps.changed.outputs.count != '0'
run: |
# Ensure we don't exit immediately on the python check
echo "## 📊 Dashboard cleanup results" >> $GITHUB_STEP_SUMMARY
echo "| Dashboard | Status | Action |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|--------|--------|" >> $GITHUB_STEP_SUMMARY
has_failed=0
# The [ -n "$f" ] ensures the last line is read even if it lacks a newline
while IFS= read -r f || [ -n "$f" ]; do
[ -z "$f" ] && continue
# Deleted dashboards still appear in git diff; skip missing files.
[ ! -f "$f" ] && continue
if python3 dashboards/misc/cleanup-dash.py --check-only "$f"; then
echo "| \`$f\` | ✅ OK | - |" >> $GITHUB_STEP_SUMMARY
else
echo "| \`$f\` | ❌ Requires cleanup | \`python3 dashboards/misc/cleanup-dash.py $f\` |" >> $GITHUB_STEP_SUMMARY
echo "::error file=$f,title=Cleanup required::Dashboard needs cleanup. Run: python3 dashboards/misc/cleanup-dash.py $f"
has_failed=1
fi
done < changed_dashboards.txt
if [ "$has_failed" -ne 0 ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "> [!CAUTION]" >> $GITHUB_STEP_SUMMARY
echo "> Some dashboards require cleanup. See table above." >> $GITHUB_STEP_SUMMARY
exit 1
fi
workflow_success:
needs: [tests, build]
name: Slack Notification success
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }}
SLACK_CHANNEL: "pmm-ci"
SLACK_USERNAME: "PR bot"
SLACK_ICON_EMOJI: ":octocat:"
SLACK_COLOR: "#00FF00"
SLACK_MESSAGE: "Workflow succeded: ${{ github.event.inputs.repo || github.repository }}:${{ github.event.inputs.branch || github.head_ref }}"
SLACK_FOOTER: "Please check the Actions URL ^"
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0
workflow_failure:
if: ${{ failure() }}
needs: [tests, build]
name: Slack Notification failure
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }}
SLACK_CHANNEL: "pmm-ci"
SLACK_USERNAME: "PR bot"
SLACK_ICON_EMOJI: ":octocat:"
SLACK_COLOR: "#FF0000"
SLACK_MESSAGE: "Workflow failed: ${{ github.event.inputs.repo || github.repository }}:${{ github.event.inputs.branch || github.head_ref }}"
SLACK_FOOTER: "Please check the Actions URL ^"
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0