Darriancze LKPR 13.4. & LKTB 4.0 #46
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: JSON Validator | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - '**/*.json' # Trigger for any JSON files in the repository | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write # enable write permissions for pull request comments | |
| jobs: | |
| json-validate: | |
| runs-on: ubuntu-latest | |
| name: Validate JSON Files | |
| steps: | |
| # Checkout the repo | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # needed to checkout all branches for this Action to work | |
| # Check the PR diff using the current branch and the base branch of the PR | |
| - uses: GrantBirki/git-diff-action@v2.8.0 | |
| id: git-diff-action | |
| with: | |
| json_diff_file_output: diff.json | |
| file_output_only: "true" | |
| # Validate JSON files | |
| - name: Validate JSON files | |
| if: ${{ steps.git-diff-action.outputs.json-diff-path != '' }} | |
| uses: GrantBirki/json-yaml-validate@v3.3.0 | |
| with: | |
| comment: "true" # enable comment mode | |
| base_dir: ./ # Base directory for validation | |
| files: ${{ steps.git-diff-action.outputs.json-diff-path }} # Validate only changed files | |
| # Explicit success message when no JSON files changed | |
| - name: No JSON files to validate | |
| if: ${{ steps.git-diff-action.outputs.json-diff-path == '' }} | |
| run: echo "✅ No JSON files were modified in this PR" | |
| # Final validation status | |
| - name: JSON Validation Complete | |
| run: echo "✅ All JSON files are valid" |