From aa3002e1fbc5e0470a34fb2559b459382dc91df8 Mon Sep 17 00:00:00 2001 From: Daniel Falk Date: Fri, 1 Aug 2025 16:04:35 +0200 Subject: [PATCH 1/4] Add instructions to CodeRabbit AI bot --- .coderabbit.yaml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .coderabbit.yaml diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..e134121 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,38 @@ +language: en-US +reviews: + profile: chill + poem: false + path_filters: [] + path_instructions: + - path: "dashboard-deployments/**" + instructions: >- + This directory contains server-side dashboard examples for visualizing data from + FixedIT Data Agent running on Axis devices. These are primarily for DevOps/IT + professionals comfortable with deploying Grafana dashboards and InfluxDB servers. + Some dashboards work directly with bundled agent configurations, others can be + customized. Licensed under Elastic License 2.0. Review for deployment complexity, + dashboard usability, and proper licensing compliance. We should make sure that + dashboards are portable and does not check in specific host names, or refer to + other specific data from a single deployment. + - path: "**/*.md" + instructions: >- + Documentation files should clearly communicate the dual audience: (1) server-side + dashboard users who want to keep agent with bundled configs, and (2) edge device + developers who want to customize agent behavior. Ensure examples and instructions + are appropriate for the intended skill level and use case. Since this is a public + repository, we should not include any sensitive information, the instructions + should be easily understandable for a wide audience, and we should avoid using + any jargon or technical terms that are not commonly used. + - path: "**/*" + instructions: >- + This repository serves FixedIT Data Agent users across a spectrum from plug-and-play + dashboard deployment to advanced edge device customization. Consider whether changes + maintain accessibility for both DevOps professionals (server-side focus) and + developers (edge customization focus). If new features are added or existing ones + changed significantly, ensure documentation clearly explains the intended audience + and usage level. We use prettier for formatting of common file formats like markdown, + yaml, json, etc. + auto_review: + enabled: true + auto_incremental_review: true + base_branches: [".*"] From 24c97cde904791c65f1e35ed30200e508a52a180 Mon Sep 17 00:00:00 2001 From: Daniel Falk Date: Fri, 1 Aug 2025 16:21:27 +0200 Subject: [PATCH 2/4] Add ci/cd job --- .github/workflows/prettier.yml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/prettier.yml diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..024d299 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,70 @@ +name: Prettier Format Check + +on: + push: + pull_request: + +permissions: + contents: read + pull-requests: write + +jobs: + prettier: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Run prettier check + run: | + # Format JSON, YAML (including workflow files), and Markdown files + npx prettier --check "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" --ignore-unknown + + - name: Get files that need formatting (on failure) + if: failure() && github.event_name == 'pull_request' + id: format_files + run: | + # Get list of files that need formatting + FILES_NEEDING_FORMAT=$(npx prettier --check "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" --ignore-unknown --list-different 2>/dev/null || true) + echo "files_list<> $GITHUB_OUTPUT + echo "$FILES_NEEDING_FORMAT" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Comment on PR (on failure) + if: failure() && github.event_name == 'pull_request' && steps.format_files.outputs.files_list != '' + uses: actions/github-script@v7 + with: + script: | + const filesList = `${{ steps.format_files.outputs.files_list }}`.trim(); + + if (filesList) { + const files = filesList.split('\n').filter(f => f.trim()); + const comment = `## 🎨 Code Formatting Required + + Some files in this PR need to be formatted with Prettier. + + This includes JSON, YAML (workflow files), and Markdown files. + + **Files that need formatting:** + ${files.map(file => `- \`${file}\``).join('\n')} + + **To fix this:** + 1. Install Prettier: \`npm install -g prettier\` + 2. Format the files: \`npx prettier --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}"\` + 3. Commit and push the changes + + The formatting check will automatically pass once these files are properly formatted.`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); + } From 34f706adcbf0c5fecc8fa478f97cc08d95cdbcfe Mon Sep 17 00:00:00 2001 From: Daniel Falk Date: Mon, 4 Aug 2025 09:51:50 +0200 Subject: [PATCH 3/4] Fix review comments --- .github/workflows/prettier.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 024d299..2335269 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -11,6 +11,12 @@ permissions: jobs: prettier: runs-on: ubuntu-latest + env: + # List of files patterns that should be formatted by prettier. This should normally include: + # workflow files (yml) and any other json/yml/markdown files, including hidden config files for tools. + PRETTIER_FILES: '"**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" ".*.{yml,yaml}"' + # Pin Prettier version to ensure deterministic CI runs and avoid unpredictable failures + PRETTIER_VERSION: "3.6.0" steps: - name: Checkout code @@ -24,14 +30,14 @@ jobs: - name: Run prettier check run: | # Format JSON, YAML (including workflow files), and Markdown files - npx prettier --check "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" --ignore-unknown + npx prettier@${{ env.PRETTIER_VERSION }} --check ${{ env.PRETTIER_FILES }} --ignore-unknown - name: Get files that need formatting (on failure) if: failure() && github.event_name == 'pull_request' id: format_files run: | # Get list of files that need formatting - FILES_NEEDING_FORMAT=$(npx prettier --check "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}" --ignore-unknown --list-different 2>/dev/null || true) + FILES_NEEDING_FORMAT=$(npx prettier@${{ env.PRETTIER_VERSION }} --check ${{ env.PRETTIER_FILES }} --ignore-unknown --list-different 2>/dev/null || true) echo "files_list<> $GITHUB_OUTPUT echo "$FILES_NEEDING_FORMAT" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT @@ -55,9 +61,8 @@ jobs: ${files.map(file => `- \`${file}\``).join('\n')} **To fix this:** - 1. Install Prettier: \`npm install -g prettier\` - 2. Format the files: \`npx prettier --write "**/*.{json,yml,yaml,md}" ".github/**/*.{json,yml,yaml,md}"\` - 3. Commit and push the changes + 1. Format the files: \`npx prettier@${{ env.PRETTIER_VERSION }} --write ${{ env.PRETTIER_FILES }} --ignore-unknown\` + 2. Commit and push the changes The formatting check will automatically pass once these files are properly formatted.`; From 0b961e761b60a100610c7907fa0d8cc7d2b66d53 Mon Sep 17 00:00:00 2001 From: Daniel Falk Date: Tue, 5 Aug 2025 15:42:37 +0200 Subject: [PATCH 4/4] Run formatter --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 88cb5d4..2aa93bc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # fixedit-data-agent-dashboards + This repository contains an InfluxDB + Grafana stack with provisioned dashboards for Axis camera monitoring with the FixedIT Data Agent edge application.