Skip to content

Commit

Permalink
feat: add inputs for specifiable config (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick authored Jan 24, 2023
1 parent c0ea92f commit 23e4f05
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
config-path: dprint-ci.json
```

## Troubleshooting

### Windows line endings
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
7 changes: 7 additions & 0 deletions dprint-another.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit 23e4f05

Please sign in to comment.