Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add inputs for specifiable config #9

Merged
merged 3 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 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,11 @@ 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
if: "${{ inputs.config-path != '' }}"
dsherret marked this conversation as resolved.
Show resolved Hide resolved
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"
]
}