commit dfae4d5bb4406de20e9e29f1fb82ecfd504ba37d Author: Peter Newman Date: Wed May 20 19:56:51 2020 +0100 Squashed 'codespell-problem-matcher/' content from commit b508e1b git-subtree-dir: codespell-problem-matcher git-subtree-split: b508e1bce5d902037845870f0b4cb75f57cd568d diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..62878d2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - uses: actions/setup-python@v1 + - run: pip install codespell + - uses: ./ + - name: Check codespell + run: codespell test/test.txt || true + - name: Check codespell on an unusually named file + run: codespell test/test:2.txt || true diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b98f145 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Peter Newman, based on korelstar's xmllint-problem-matcher + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5b399b0 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# codespell-problem-matcher + +This problem matcher lets you show errors from `codespell` as annotation in +GitHub Actions. + +Based on [korelstar](https://github.com/korelstar)'s [xmllint-problem-matcher](https://github.com/korelstar/xmllint-problem-matcher). + +## Inputs + +No inputs are required. + +## Outputs + +No outputs are generated apart from a configured problem matcher. + +## Usage + +Add the step to your workflow, before `codespell` is called. + +```yaml + - uses: codespell-project/codespell-problem-matcher@v1 +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..6d34e83 --- /dev/null +++ b/action.yml @@ -0,0 +1,9 @@ +name: 'codespell problem matcher' +author: 'Peter Newman' +description: 'Shows codespell errors as annotation (with file and code line) in GitHub Actions' +runs: + using: 'node12' + main: 'index.js' +branding: + icon: 'search' + color: 'green' diff --git a/codespell-matcher.json b/codespell-matcher.json new file mode 100644 index 0000000..4ea7d93 --- /dev/null +++ b/codespell-matcher.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "owner": "codespell-matcher", + "pattern": [ + { + "regexp": "^(.+):(\\d+):\\s+(.+)$", + "file": 1, + "line": 2, + "message": 3 + } + ] + } + ] +} diff --git a/index.js b/index.js new file mode 100755 index 0000000..b3552d0 --- /dev/null +++ b/index.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log(`::add-matcher::${__dirname}/codespell-matcher.json`); diff --git a/test/test.txt b/test/test.txt new file mode 100644 index 0000000..024f418 --- /dev/null +++ b/test/test.txt @@ -0,0 +1,4 @@ +abandonned +Abandonned +ABANDONNED +AbAnDoNnEd diff --git a/test/test:2.txt b/test/test:2.txt new file mode 100644 index 0000000..50a0985 --- /dev/null +++ b/test/test:2.txt @@ -0,0 +1 @@ +It's ackward when you make a spelling mistake.