diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ede899f..6d8d630 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,3 +23,14 @@ jobs: uses: ./ with: dprint-version: 0.30.3 + + - name: Check formatting specific config + uses: ./ + with: + config-path: 'dprint-another.json' + + - name: Check formatting specific version and config + uses: ./ + with: + dprint-version: 0.30.3 + config-path: 'dprint-another.json' diff --git a/README.md b/README.md index 19f9843..32d866b 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,20 @@ To use a specific version, specify that with the `dprint-version` input: dprint-version: 0.30.3 ``` +### Config Path + +By default, `dprint/check` uses the `dprint.json`. + +### Specific Config + +To use a specific config, specify that with the `config-path` input: + +```yml +- uses: dprint/check@v2.1 + with: + config-path: dprint-ci.json +``` + ## Troubleshooting ### Windows line endings diff --git a/action.yml b/action.yml index 24e56e5..0d519a5 100644 --- a/action.yml +++ b/action.yml @@ -6,6 +6,10 @@ inputs: description: 'Specific dprint version to use (ex. 0.30.3)' required: false default: '' + config-path: + description: 'Specific dprint config to use (ex. dprint.json)' + required: false + default: '' runs: using: 'composite' steps: @@ -16,7 +20,12 @@ runs: echo "/home/runner/.dprint/bin" >> $GITHUB_PATH - name: Check formatting shell: bash + if: "${{ inputs.config-path == '' }}" run: ~/.dprint/bin/dprint check + - name: Check formatting with config + shell: bash + if: "${{ inputs.config-path != '' }}" + run: ~/.dprint/bin/dprint check --config '${{ inputs.config-path }}' branding: icon: 'check-circle' color: 'gray-dark' diff --git a/dprint-another.json b/dprint-another.json new file mode 100644 index 0000000..55191fa --- /dev/null +++ b/dprint-another.json @@ -0,0 +1,7 @@ +{ + "includes": ["**/*.{md,json}"], + "plugins": [ + "https://plugins.dprint.dev/json-0.15.3.wasm", + "https://plugins.dprint.dev/markdown-0.13.3.wasm" + ] +}