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 dprint-version input #4

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v2

- name: Check formatting
- name: Check formatting latest
uses: ./
with:
dprint-version: latest

- name: Check formatting specific version
uses: ./
with:
dprint-version: 0.17.0
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,19 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: dprint/check@v1.6
- uses: dprint/check@v2.0
```

### Latest Version

By default, `dprint/check` uses the latest version of dprint.

### Specific Version

To use a specific version, specify that with the `dprint-version` input:

```yml
- uses: dprint/check@v2.0
with:
dprint-version: "0.17.0"
```
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@
name: 'dprint-check-action'
description: 'Run `dprint check` on your source code'
author: 'thomaseizinger'
inputs:
dprint-version:
description: The specific dprint version to install (ex. 0.17.0).
default: "latest"
runs:
using: 'composite'
steps:
- name: Install dprint
shell: bash
run: |
curl -fsSL https://dprint.dev/install.sh | sh -s 0.17.0 > /dev/null 2>&1
echo "Installing dprint ${{ inputs.dprint-version }}"
chmod +x install.sh
./install.sh "${{ inputs.dprint-version }}"
echo "/home/runner/.dprint/bin" >> $GITHUB_PATH
- name: Check formatting
shell: bash
Expand Down
1 change: 0 additions & 1 deletion dprint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"$schema": "https://dprint.dev/schemas/v0.json",
"incremental": true,
"includes": ["**/*.{md,json}"],
"plugins": [
Expand Down
8 changes: 8 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

if [ "$1" -eq "latest" ]
then
curl -fsSL https://dprint.dev/install.sh | sh > /dev/null 2>&1
else
curl -fsSL https://dprint.dev/install.sh | sh -s "$1" > /dev/null 2>&1
fi