Skip to content

Github action to check the validity of json files.

License

Notifications You must be signed in to change notification settings

RaaLabs/validate-json

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

validate-json

Build Docker Image

This action validates json files. The action scans the repository for files with the .json extension, and tries to unmarshall them. If there are unmarshalling errors, the action terminates and your workflow will break. It will log all errors encountered before exiting.

The action is run using a Docker container and is written in Go.

Warning We are switching from Docker Hub to GitHub container registry to store the images for this action (Docker sunsets free plans for teams). Use version >=1.0.0 going forward as the previous versions will stop working once Docker removes the images from Docker hub (pull rate limits apply from 14.April 2023, removal on 14.May 2023)

Inputs

  • directory: (string, optional) The path on which to scan .json files, defaults to ., in which case it scans the whole repository.

Usage

Complete sample workflow. For mor information see the action.yml, and the GitHub help documentation here https://docs.github.com/en/actions/using-workflows#creating-a-workflow-file

name: Validate json files

on:
  pull_request:
    branches: [ main ]

jobs:
  validate-json:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 2

    - name: Validate json files
      uses: RaaLabs/validate-json@v1.0.1
      with:
        directory: "."