Skip to content

Commit d8c6c01

Browse files
committed
refactor: update prettier job, add doctoc
This modifies the prettier job to use actionsx/prettier. It also adds a job for `doctoc`.
1 parent 9825c13 commit d8c6c01

File tree

1 file changed

+28
-15
lines changed

1 file changed

+28
-15
lines changed

.github/workflows/build.yaml

+28-15
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,47 @@ concurrency:
2222
# will skip running `yarn install` if it successfully fetched from cache
2323

2424
jobs:
25-
fmt:
25+
prettier:
2626
name: Format with Prettier
2727
runs-on: ubuntu-latest
2828
timeout-minutes: 5
2929
steps:
3030
- name: Checkout repo
3131
uses: actions/checkout@v3
3232

33+
- name: Run prettier with actionsx/prettier
34+
uses: actionsx/prettier@v2
35+
with:
36+
args: --check --loglevel=warn .
37+
38+
doctoc:
39+
name: Doctoc markdown files
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 5
42+
steps:
43+
- name: Checkout repo
44+
uses: actions/checkout@v3
45+
46+
- name: Get changed files
47+
id: changed-files
48+
uses: tj-actions/[email protected]
49+
with:
50+
files: |
51+
docs/**
52+
3353
- name: Install Node.js v16
54+
if: steps.changed-files.outputs.any_changed == 'true'
3455
uses: actions/setup-node@v3
3556
with:
3657
node-version: "16"
58+
cache: "yarn"
3759

38-
- name: Fetch dependencies from cache
39-
id: cache-node-modules
40-
uses: actions/cache@v3
41-
with:
42-
path: "**/node_modules"
43-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
44-
restore-keys: |
45-
yarn-build-
46-
47-
- name: Install dependencies
48-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
49-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
60+
- name: Install doctoc
61+
run: yarn global add [email protected]
5062

51-
- name: Format files with Prettier
52-
run: yarn fmt
63+
- name: Run doctoc
64+
if: steps.changed-files.outputs.any_changed == 'true'
65+
run: yarn doctoc
5366

5467
lint-helm:
5568
name: Lint Helm chart

0 commit comments

Comments
 (0)