-
Notifications
You must be signed in to change notification settings - Fork 257
Add automated type exports check #2742
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
base: integration/v9
Are you sure you want to change the base?
Changes from all commits
516711f
54aff99
a72472c
b558134
2d3cf84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,84 @@ | ||||||
| name: "Are the types wrong?" | ||||||
| on: [pull_request] | ||||||
| permissions: | ||||||
| pull-requests: write | ||||||
|
|
||||||
| jobs: | ||||||
| build: | ||||||
| name: Are the types wrong? | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Setup node | ||||||
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | ||||||
| with: | ||||||
| node-version: 22 | ||||||
|
|
||||||
| - name: Checkout PR branch | ||||||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||||||
|
|
||||||
| - name: Install and build | ||||||
| env: | ||||||
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | ||||||
| ELECTRON_DISABLE_SANDBOX: 1 | ||||||
| run: | | ||||||
| npm ci | ||||||
| npm run build | ||||||
|
|
||||||
| - name: Run ATTW check | ||||||
| continue-on-error: true | ||||||
| env: | ||||||
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | ||||||
| ELECTRON_DISABLE_SANDBOX: 1 | ||||||
| run: | | ||||||
| npm run test:attw || true | ||||||
|
Comment on lines
+27
to
+33
|
||||||
|
|
||||||
| - name: Parse ATTW results and comment | ||||||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||||||
| with: | ||||||
| script: | | ||||||
| const { execSync } = require('child_process'); | ||||||
|
|
||||||
| // Run the parse script to get markdown output | ||||||
| let commentBody; | ||||||
| try { | ||||||
| commentBody = execSync('node scripts/parse-attw-results.js --format=markdown', { | ||||||
| encoding: 'utf8', | ||||||
| stdio: ['pipe', 'pipe', 'pipe'] | ||||||
| }); | ||||||
| } catch (error) { | ||||||
| // Script exits with code 1 if there are problems, but we still want the output | ||||||
| commentBody = error.stdout || error.message; | ||||||
| } | ||||||
|
|
||||||
| if (!commentBody || !commentBody.includes('Are The Types Wrong? Report')) { | ||||||
| console.log('No valid output from parse script'); | ||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| // Post or update comment | ||||||
| const { data: comments } = await github.rest.issues.listComments({ | ||||||
| owner: context.repo.owner, | ||||||
| repo: context.repo.repo, | ||||||
| issue_number: context.issue.number, | ||||||
| }); | ||||||
|
|
||||||
| const botComment = comments.find(comment => | ||||||
| comment.user.type === 'Bot' && | ||||||
|
||||||
| comment.user.type === 'Bot' && | |
| comment.user.login === 'github-actions[bot]' && |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,3 +24,5 @@ Gemfile.lock | |
| *.iml | ||
| zscaler-root-ca.crt* | ||
| .ts38-validation | ||
| # Arethetypeswrong working files | ||
| attw-results.json | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow uses
github.rest.issues.*APIs to create/update PR comments, but the token permissions only grantpull-requests: write. To avoid 403s, add the required permissions explicitly (typicallyissues: write, and oftencontents: readas well). Also consider guarding the commenting step for forked PRs whereGITHUB_TOKENis read-only, so the workflow doesn’t fail unexpectedly.