Skip to content

Latest commit

 

History

History
82 lines (55 loc) · 2.06 KB

json-lint.md

File metadata and controls

82 lines (55 loc) · 2.06 KB

json-lint

The json-lint workflow is located at .github/workflows/json-lint.yml.

This workflow will use eslint to lint JSON files in the target repository. You can use the paths filter to only trigger this workflow for specific files or file patterns. More on this in the usage section.

This reusable action depends on the following actions:

Inputs

The action has the following inputs:

Required inputs

target-repo

Specify the target repository this action should run on. This is used to prevent actions from running on repositories other than the target repository. For example, specifying a target-repo of mdn/workflows will prevent the action from running on forks of mdn/workflows.

  • This input is required

Optional inputs

node-version

The node version to setup and use.

  • This input is optional, with a default of 16.

cache

Which package manager cache to use.

  • This input is optional, with a default of yarn.

Usage

With defaults

name: json-lint

on:
  pull_request:
    branches:
      - main
    paths:
      - "*.json"
      - .github/workflows/json-lint.yml

jobs:
  json-lint:
    uses: mdn/workflows/.github/workflows/json-lint.yml@main
    with:
      target-repo: "mdn/workflows"

Above you can see how the paths filter is being used to specify specific files and file patterns.

Overriding some defaults

name: json-lint

on:
  pull_request:
    branches:
      - main
    paths:
      - "*.json"
      - .github/workflows/json-lint.yml

jobs:
  json-lint:
    uses: mdn/workflows/.github/workflows/json-lint.yml@main
    with:
      cache: "npm"
      node-version: 18
      target-repo: "mdn/workflows"