diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml deleted file mode 100644 index 4875842..0000000 --- a/.github/workflows/CI.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: CI - -on: [push, pull_request] - -jobs: - style: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Check formatting latest - uses: ./ - - - name: Check formatting specific version - uses: ./ - with: - dprint-version: 0.17.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ede899f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: [push, pull_request] + +jobs: + style: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] + steps: + - name: Use LF line endings + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - uses: actions/checkout@v3 + + - name: Check formatting latest + uses: ./ + + - name: Check formatting specific version + uses: ./ + with: + dprint-version: 0.30.3 diff --git a/README.md b/README.md index 1e93ae6..02f7de7 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,17 @@ jobs: style: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: dprint/check@v2.0 + - uses: dprint/check@v2.1 +``` + +If you are using a matrix, most likely you will only want to run it only on Linux. For example: + +```yml +- name: Check format + if: runner.os == 'Linux' + uses: dprint/check@v2.1 ``` ### Latest Version @@ -26,7 +34,32 @@ By default, `dprint/check` uses the latest version of dprint. To use a specific version, specify that with the `dprint-version` input: ```yml -- uses: dprint/check@v2.0 +- uses: dprint/check@v2.1 with: - dprint-version: 0.17.0 + dprint-version: 0.30.3 +``` + +## Troubleshooting + +### Windows line endings + +When running on Windows, you may get a lot of messages like: + +``` +from D:\a\check\check\README.md: + | Text differed by line endings. +-- +``` + +This is because unfortunately git is configured in GH actions to check out line endings as CRLF (`\r\n`). + +You can fix this by only running the action on Linux as shown above (recommended), or to do the following before checking out the repo: + +```yml +- name: Ensure LF line endings for Windows + run: | + git config --global core.autocrlf false + git config --global core.eol lf + +- uses: actions/checkout@v3 ``` diff --git a/action.yml b/action.yml index 40b109b..5c60587 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ description: 'Run `dprint check` on your source code' author: 'thomaseizinger' inputs: dprint-version: - description: 'Specific dprint version to use (ex. 0.17.0)' + description: 'Specific dprint version to use (ex. 0.30.3)' required: false default: '' runs: @@ -17,7 +17,7 @@ runs: echo "/home/runner/.dprint/bin" >> $GITHUB_PATH - name: Check formatting shell: bash - run: dprint check + run: ~/.dprint/bin/dprint check branding: icon: 'check-circle' color: 'gray-dark' diff --git a/dprint.json b/dprint.json index ff0abee..55191fa 100644 --- a/dprint.json +++ b/dprint.json @@ -1,8 +1,7 @@ { - "incremental": true, "includes": ["**/*.{md,json}"], "plugins": [ - "https://plugins.dprint.dev/json-0.13.0.wasm", - "https://plugins.dprint.dev/markdown-0.10.0.wasm" + "https://plugins.dprint.dev/json-0.15.3.wasm", + "https://plugins.dprint.dev/markdown-0.13.3.wasm" ] }