Skip to content

Commit 663ac0a

Browse files
committed
CI typecheck and lint
1 parent 2f7b9fa commit 663ac0a

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.github/workflows/stage-1-commit.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,56 @@ jobs:
146146
uses: actions/checkout@v5
147147
- name: "Lint Terraform"
148148
uses: ./.github/actions/lint-terraform
149+
150+
detect-typescript-changes:
151+
name: "Detect TypeScript Changes"
152+
runs-on: ubuntu-latest
153+
outputs:
154+
typescript_changed: ${{ steps.check.outputs.typescript_changed }}
155+
steps:
156+
- name: "Checkout code"
157+
uses: actions/checkout@v5
158+
159+
- name: "Check for TypeScript changes"
160+
id: check
161+
run: |
162+
git fetch origin main || true # Ensure you have the latest main branch
163+
CHANGED_FILES=$(git diff --name-only HEAD origin/main)
164+
echo "Changed files: $CHANGED_FILES"
165+
166+
if echo "$CHANGED_FILES" | grep -qE '\.ts$'; then
167+
echo "Typescript files have changed."
168+
echo "typescript_changed=true" >> $GITHUB_OUTPUT
169+
else
170+
echo "No Typescript changes detected."
171+
echo "typescript_changed=false" >> $GITHUB_OUTPUT
172+
fi
173+
typecheck-typescript:
174+
name: "Typecheck TypeScript"
175+
runs-on: ubuntu-latest
176+
timeout-minutes: 5
177+
needs: detect-typescript-changes
178+
if: needs.detect-typescript-changes.outputs.typescript_changed == 'true'
179+
steps:
180+
- name: "Checkout code"
181+
uses: actions/checkout@v5
182+
- name: "Typecheck TypeScript"
183+
run: |
184+
npm run typecheck --workspaces
185+
lint-typescript:
186+
name: "Typecheck TypeScript"
187+
runs-on: ubuntu-latest
188+
timeout-minutes: 5
189+
needs: detect-typescript-changes
190+
if: needs.detect-typescript-changes.outputs.typescript_changed == 'true'
191+
steps:
192+
- name: "Checkout code"
193+
uses: actions/checkout@v5
194+
- name: "Typecheck TypeScript"
195+
run: |
196+
npm run lint --workspaces
197+
198+
149199
trivy:
150200
name: "Trivy Scan"
151201
runs-on: ubuntu-latest

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"build": "JEKYLL_ENV=production bundle exec jekyll build --trace --config _config.yml,_config.version.yml",
1515
"debug": "JEKYLL_ENV=development BUNDLE_GEMFILE=Gemfile bundle exec jekyll serve --config _config.yml,_config.dev.yml,_config.version.yml --limit_posts 100 --trace",
1616
"generate-includes": "./generate-includes.sh",
17-
"lint": "echo \"Documentation module has no code to lint\"",
17+
"lint": "echo \"Documentation module has no typescript to lint\"",
1818
"test:unit": "echo \"Documentation module has no unit tests\"",
1919
"typecheck": "echo \"Documentation module has no typescript to typecheck\""
2020
},

0 commit comments

Comments
 (0)