Skip to content

Commit 05003e7

Browse files
masl2nhsd-david-wass
authored andcommitted
CI typecheck and lint
1 parent 1e19943 commit 05003e7

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

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

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

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)