-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add GitHub Action for JavaScript type checking via TypeScript #11131
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: trunk
Are you sure you want to change the base?
Changes from all commits
d220733
31d017c
3cfad50
d2ad278
6dfc36b
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,98 @@ | ||
| name: JavaScript Type Checking | ||
|
|
||
| on: | ||
| # JavaScript type checking was introduced in 7.0.0. | ||
| push: | ||
| branches: | ||
| - trunk | ||
| - '[7-9].[0-9]' | ||
| tags: | ||
| - '[7-9].[0-9]' | ||
| - '[7-9]+.[0-9].[0-9]+' | ||
| pull_request: | ||
| branches: | ||
| - trunk | ||
| - '[7-9].[0-9]' | ||
| paths: | ||
| # This workflow only scans JavaScript files. | ||
| - '**.js' | ||
| # These files configure npm. Changes could affect the outcome. | ||
| - 'package*.json' | ||
| - '.nvmrc' | ||
| # This file configures TypeScript. Changes could affect the outcome. | ||
| - 'tsconfig.json' | ||
| # This directory contains TypeScript definitions. Changes could affect the outcome. | ||
| - 'typings/**' | ||
| # Confirm any changes to relevant workflow files. | ||
| - '.github/workflows/javascript-type-checking.yml' | ||
| - '.github/workflows/reusable-javascript-type-checking.yml' | ||
| workflow_dispatch: | ||
|
|
||
| # Cancels all previous workflow runs for pull requests that have not completed. | ||
| concurrency: | ||
| # The concurrency group contains the workflow name and the branch name for pull requests | ||
| # or the commit hash for any other events. | ||
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| # Disable permissions for all available scopes by default. | ||
| # Any needed permissions should be configured at the job level. | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| # Runs JavaScript type checking. | ||
| typecheck: | ||
| name: JavaScript type checking | ||
| uses: ./.github/workflows/reusable-javascript-type-checking.yml | ||
| permissions: | ||
| contents: read | ||
| if: ${{ github.repository == 'WordPress/wordpress-develop' || ( github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' ) }} | ||
|
|
||
| slack-notifications: | ||
| name: Slack Notifications | ||
| uses: ./.github/workflows/slack-notifications.yml | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| needs: [ typecheck ] | ||
| if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} | ||
| with: | ||
| calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} | ||
| secrets: | ||
| SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} | ||
| SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} | ||
| SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} | ||
| SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} | ||
|
|
||
| failed-workflow: | ||
| name: Failed workflow tasks | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| actions: write | ||
| needs: [ slack-notifications ] | ||
| if: | | ||
| always() && | ||
| github.repository == 'WordPress/wordpress-develop' && | ||
| github.event_name != 'pull_request' && | ||
| github.run_attempt < 2 && | ||
| ( | ||
| contains( needs.*.result, 'cancelled' ) || | ||
| contains( needs.*.result, 'failure' ) | ||
| ) | ||
|
|
||
| steps: | ||
| - name: Dispatch workflow run | ||
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | ||
| with: | ||
| retries: 2 | ||
| retry-exempt-status-codes: 418 | ||
| script: | | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| workflow_id: 'failed-workflow.yml', | ||
| ref: 'trunk', | ||
| inputs: { | ||
| run_id: `${context.runId}`, | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||
| ## | ||||||
| # A reusable workflow that runs JavaScript Type Checking. | ||||||
| ## | ||||||
| name: JavaScript Type Checking | ||||||
|
|
||||||
| on: | ||||||
| workflow_call: | ||||||
|
|
||||||
| # Disable permissions for all available scopes by default. | ||||||
| # Any needed permissions should be configured at the job level. | ||||||
| permissions: {} | ||||||
|
|
||||||
| jobs: | ||||||
| # Runs JavaScript type checking. | ||||||
| # | ||||||
| # Violations are reported inline with annotations. | ||||||
|
||||||
| # Violations are reported inline with annotations. | |
| # Violations are reported in the workflow logs. |
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.
I don't think this is correct. Inline annotations are working as seen in #11131 (comment)
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.
For some reason this hadn't been updated to match all of the other workflows.