From f112096aa2319d569c565554ea87ce54ed50d726 Mon Sep 17 00:00:00 2001 From: Shinya Ishikawa Date: Tue, 21 May 2024 22:04:46 +0900 Subject: [PATCH] Add GitHub Actions --- .github/workflows/textlint.yml | 34 ++++++++++++++++++++++++++++++++++ textlint/.gitignore | 3 ++- textlint/package.json | 3 ++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/textlint.yml diff --git a/.github/workflows/textlint.yml b/.github/workflows/textlint.yml new file mode 100644 index 000000000..a08b7ebbb --- /dev/null +++ b/.github/workflows/textlint.yml @@ -0,0 +1,34 @@ +name: textlint +on: + push: + branches: + - dev/translate-jp + pull_request: + branches: + - dev/translate-jp +jobs: + textlint: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Run textlint + run: cd textlint && npm install && npm run textlint:ci + - name: Upload lint results artifact + uses: actions/upload-artifact@v2 + with: + name: textlint-results + path: textlint/results.xml + - name: Comment lint results on PR + if: ${{ github.event_name == 'pull_request' }} + uses: ScaCap/action-surefire-report@v1 + with: + report_paths: 'textlint/results.xml' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/textlint/.gitignore b/textlint/.gitignore index b512c09d4..efd94d7ea 100644 --- a/textlint/.gitignore +++ b/textlint/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +results.xml \ No newline at end of file diff --git a/textlint/package.json b/textlint/package.json index 23f8927ab..8c3c4bfc4 100644 --- a/textlint/package.json +++ b/textlint/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "textlint": "textlint --rulesdir=. --ignore-path=\"./.textlintignore\" \"../**/*.md\" " + "textlint": "textlint --rulesdir=. --ignore-path=\"./.textlintignore\" \"../**/*.md\" ", + "textlint:ci": "textlint --format=junit --output-file=./results.xml --rulesdir=. --ignore-path=\"./.textlintignore\" \"../**/*.md\" " }, "keywords": [], "author": "Shinya Ishikawa (https://meganetaaan.github.io/)",