Skip to content

Commit eafd37a

Browse files
committed
add style checkers for go, js, and ts
1 parent c74eb48 commit eafd37a

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

.github/workflows/build-samples-json.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Trigger Docs Samples Rebuild
22
permissions:
33
contents: read
4+
pull-requests: read
45

56
on:
67
push:
@@ -16,15 +17,23 @@ jobs:
1617
- name: Checkout code
1718
uses: actions/checkout@v4
1819

20+
- name: Get list of changed files
21+
id: changed
22+
run: |
23+
files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep '\.py$' || true)
24+
echo "files=$files" >> "$GITHUB_OUTPUT"
25+
1926
- name: Run Ruff linter
2027
uses: astral-sh/ruff-action@v1
2128
with:
22-
args: check ./samples
29+
args: check
30+
src: ${{ steps.changed.outputs.files }}
2331

2432
- name: Run Ruff formatter check
2533
uses: astral-sh/ruff-action@v1
2634
with:
2735
args: "format --check"
36+
src: ${{ steps.changed.outputs.files }}
2837

2938
js-ts-lint:
3039
runs-on: ubuntu-latest
@@ -37,8 +46,27 @@ jobs:
3746
with:
3847
node-version: '20'
3948

49+
- name: Get list of changed JS/TS files
50+
id: changed_js
51+
run: |
52+
files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep -E '\.(js|ts|jsx|tsx)$' || true)
53+
echo "files=$files" >> "$GITHUB_OUTPUT"
54+
4055
- name: Run ESLint (JS/TS only)
41-
run: npx eslint "samples/**/*.{js,ts,jsx,tsx}"
56+
run: |
57+
if [ -n "${{ steps.changed_js.outputs.files }}" ]; then
58+
npx eslint ${{ steps.changed_js.outputs.files }}
59+
else
60+
echo "No JS/TS files to lint."
61+
fi
62+
63+
- name: Run Prettier check (JS/TS only)
64+
run: |
65+
if [ -n "${{ steps.changed_js.outputs.files }}" ]; then
66+
npx prettier --check ${{ steps.changed_js.outputs.files }}
67+
else
68+
echo "No JS/TS files to format check."
69+
fi
4270
4371
go-lint:
4472
runs-on: ubuntu-latest
@@ -54,11 +82,13 @@ jobs:
5482
- name: Run golangci-lint
5583
uses: golangci/golangci-lint-action@v8
5684
with:
85+
args: --enable gofmt --enable goimports
86+
only-new-issues: true
5787
version: latest
58-
working-directory: ./samples
5988

6089
build-json:
6190
runs-on: ubuntu-latest
91+
needs: [python-lint, js-ts-lint, go-lint]
6292
steps:
6393
- name: Trigger CLI Autodoc
6494
uses: peter-evans/repository-dispatch@v1

0 commit comments

Comments
 (0)