-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Add project-wide typecheck to CI #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
7afb094
ci: add project-wide typecheck workflow for main and PRs
nat-openclaw 21e5ad7
Merge branch 'main' into feat/add-project-wide-type-check
Nat3z 087bb26
Remove duplicate 'typecheck' script from package.json
Nat3z f4454f8
Fix formatting in package.json for release-beta script
Nat3z 56a4b5f
fix(typecheck): resolve CI typecheck failures
nat-openclaw 74615d6
fix(typecheck): fix addonName field mapping in RequestService
2f05adc
fix(typecheck): resolve Svelte type errors
nat-openclaw 1c5c243
fix(typecheck): resolve Svelte type errors and improve tsconfig modul…
nat-openclaw 40c21ba
fix(typecheck): resolve all TypeScript module resolution and top-leve…
nat-openclaw 1a1b7d8
ci: add typecheck comment posting script and GitHub Actions workflow
nat-openclaw 5e56d03
docs: add typecheck script documentation
nat-openclaw 5bcdfde
Delete .github/workflows/typecheck.yml
Nat3z 9d91eeb
Ci/typecheck comment (#58)
Nat3z 1e6d847
Enable concurrency for typecheck workflow
Nat3z 653b1df
Ci/typecheck comment fix (#59)
Nat3z 1f08fc4
fix(ci): address CodeRabbit review - improve typecheck workflow and f…
cd5a47f
ci: combine typecheck and comment workflows
ae8e622
ci: fix typecheck reporting logic and match flex pattern
nat-openclaw 784f6a6
ci: verify gpg signing with new key
nat-openclaw 653dbff
ci: strip ansi codes from typecheck results
nat-openclaw 17290c4
Delete TYPECHECK_README.md
Nat3z 163be73
Delete post-typecheck-comment.sh
Nat3z 4fc07f1
chore: improve typecheck workflow (main-only, pipefail, error regex, …
nat-openclaw bf31d04
Update typecheck.yml
nat-openclaw e2d2bc0
Delete scripts/typecheck-with-comment.sh
Nat3z File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Unified typecheck workflow matching Flex pattern | ||
| name: Typecheck | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["main"] | ||
| pull_request: | ||
| branches: ["**"] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: "1" | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.bun/install/cache | ||
| node_modules | ||
| application/node_modules | ||
| packages/*/node_modules | ||
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb', '**/bun.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-bun- | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Run typecheck | ||
| id: typecheck | ||
| run: | | ||
| set -o pipefail | ||
| bun run typecheck 2>&1 | tee typecheck-output.txt | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| - name: Extract errors | ||
| if: always() | ||
| id: errors | ||
| run: | | ||
| if [ -f typecheck-output.txt ] && grep -qE 'error TS|Error:' typecheck-output.txt; then | ||
| echo "has_errors=true" >> $GITHUB_OUTPUT | ||
| # Strip ANSI escape codes; capture lines with real errors (not e.g. "0 errors") | ||
| sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" typecheck-output.txt | grep -E 'error TS|Error:' > errors.txt || true | ||
| else | ||
| echo "has_errors=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| - name: Upload typecheck results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: typecheck-results | ||
| path: errors.txt | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Post review on errors | ||
| if: steps.errors.outputs.has_errors == 'true' && github.event_name == 'pull_request' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const MAX_BODY = 60000; | ||
| let errors = ''; | ||
| if (fs.existsSync('errors.txt')) { | ||
| errors = fs.readFileSync('errors.txt', 'utf8'); | ||
| } | ||
| if (errors.length > MAX_BODY) { | ||
| errors = errors.slice(0, MAX_BODY) + '\n...truncated'; | ||
| } | ||
| const pullNumber = context.eventName === 'workflow_run' | ||
| ? (context.payload.workflow_run?.pull_requests?.length > 0 | ||
| ? context.payload.workflow_run.pull_requests[0].number | ||
| : null) | ||
| : context.issue.number; | ||
| if (pullNumber == null) { | ||
| console.log('Skipping review: no PR number available'); | ||
| return; | ||
| } | ||
| await github.rest.pulls.createReview({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: pullNumber, | ||
| event: 'REQUEST_CHANGES', | ||
| body: `❌ **Typecheck Failed**\n\nPlease fix the following type errors:\n\n\`\`\`\n${errors}\n\`\`\`` | ||
| }); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.