Skip to content

Commit f4037e1

Browse files
authored
ci: lint automation using github workflow textlint_lint.yml and lint-staged (#926 #971) (#1048)
* ci: lint automation using github workflow textlint_lint.yml and lint-staged * ci: update pull_request event to textlint_lint.yml * fix(convention): sync convention with other workflows
1 parent ac57a11 commit f4037e1

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.github/workflows/textlint_lint.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Textlint Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/**/*.md'
9+
- 'textlint/**/*.js'
10+
- '.github/workflows/textlint_lint.yml'
11+
12+
pull_request:
13+
types:
14+
- opened
15+
- synchronize
16+
- reopened
17+
paths:
18+
- 'src/**/*.md'
19+
- 'textlint/**/*.js'
20+
- '.github/workflows/textlint_lint.yml'
21+
22+
jobs:
23+
Lint:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Set up checkout
28+
uses: actions/checkout@v4
29+
30+
- name: Set up node
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: 20.x
34+
cache: yarn
35+
36+
- name: Set up cache
37+
uses: actions/cache@v4
38+
with:
39+
path: ~/.yarn-cache
40+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
41+
42+
- name: Install dependencies
43+
run: yarn install --frozen-lockfile
44+
# The `--frozen-lockfile` flag in Yarn ensures that dependencies are installed without modifying the `yarn.lock` file. It is useful for maintaining consistency in CI/CD environments by preventing unexpected changes to the lock file and ensuring that the same versions of dependencies are installed.
45+
46+
- name: Lint
47+
run: yarn textlint-lint

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@
116116
},
117117
"lint-staged": {
118118
"*.{js,ts,jsx,tsx,css}": "yarn prettier",
119-
"src/**/*.md": "yarn fix-headings",
119+
"src/**/*.md": [
120+
"yarn fix-headings",
121+
"yarn textlint-lint"
122+
],
120123
"textlint/**/*.js": "yarn textlint-test",
121124
"textlint/data/rules/translateGlossary.js": "yarn textlint-docs",
122125
"textlint/generators/genTranslateGlossaryDocs.js": "yarn textlint-docs"

0 commit comments

Comments
 (0)