Skip to content

Commit

Permalink
Merge branch 'main' into unicodeSets
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Mar 16, 2024
2 parents 1782a3d + 9866640 commit 1bef75f
Show file tree
Hide file tree
Showing 3,857 changed files with 85,973 additions and 282,216 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
{ "selector": "property", "format": null }
],

"@typescript-eslint/unified-signatures": "error",
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],

// Rules enabled in typescript-eslint configs that are not applicable here
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/class-literal-property-style": "off",
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ defaults:

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-14
node-version:
- '20'
- '18'
Expand All @@ -34,9 +37,15 @@ jobs:
- 'true'
include:
- node-version: '*'
bundle: 'false'
bundle: false
os: ubuntu-latest
exclude:
# No Node 14 on ARM macOS
- node-version: '14'
os: macos-14

name: Test Node ${{ matrix.node-version }} with --bundle=${{ matrix.bundle }}
runs-on: ${{ matrix.os }}
name: Test Node ${{ matrix.node-version }} on ${{ matrix.os }}${{ (!matrix.bundle && ' with --no-bundle') || '' }}

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down Expand Up @@ -76,7 +85,7 @@ jobs:
check-latest: true
- run: npm ci

- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
- uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: ~/.cache/dprint
key: ${{ runner.os }}-dprint-${{ hashFiles('package-lock.json', '.dprint.jsonc') }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/close-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ jobs:
close_issues "Declined"
close_issues "Won't Fix"
close_issues "Too Complex"
close_issues "Design Limitation"
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/init@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
with:
config-file: ./.github/codeql/codeql-configuration.yml
# Override language selection by uncommenting this and choosing your languages
Expand All @@ -56,7 +56,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/autobuild@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,4 +70,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/analyze@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
82 changes: 50 additions & 32 deletions .github/workflows/create-cherry-pick-pr.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Create cherry pick PR

on:
repository_dispatch:
types: [create-cherry-pick-pr]
workflow_dispatch:
inputs:
pr:
Expand All @@ -13,10 +11,26 @@ on:
description: Target branch to cherry-pick to
required: true
type: string

# Inputs provided by the bot
distinct_id:
description: '(bot) A distinct ID'
required: false
default: ''
source_issue:
description: '(bot) The issue that triggered this workflow'
required: false
default: ''
requesting_user:
description: User who requested the cherry-pick
required: true
type: string
description: '(bot) The user who requested this workflow'
required: false
default: ''
status_comment:
description: '(bot) The comment to update with the status of this workflow'
required: false
default: ''

run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})', inputs.distinct_id) || '' }}

permissions:
contents: read
Expand All @@ -40,15 +54,27 @@ jobs:
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}

- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: open-pr
env:
PR: ${{ inputs.pr || github.event.client_payload.pr }}
TARGET_BRANCH: ${{ inputs.target_branch || github.event.client_payload.target_branch }}
REQUESTING_USER: ${{ inputs.requesting_user || github.event.client_payload.requesting_user }}
PR: ${{ inputs.pr }}
TARGET_BRANCH: ${{ inputs.target_branch }}
DISTINCT_ID: ${{ inputs.distinct_id }}
SOURCE_ISSUE: ${{ inputs.source_issue }}
REQUESTING_USER: ${{ inputs.requesting_user }}
STATUS_COMMENT: ${{ inputs.status_comment }}
with:
retries: 3
github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
result-encoding: string
script: |
const { PR, TARGET_BRANCH, REQUESTING_USER } = process.env;
const {
PR,
TARGET_BRANCH,
DISTINCT_ID,
SOURCE_ISSUE,
REQUESTING_USER,
STATUS_COMMENT,
} = process.env;
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
Expand All @@ -75,6 +101,8 @@ jobs:
head: `${context.repo.owner}:${pickBranch}`,
});
let commentBody;
if (existingPulls.data.length === 0) {
console.log(`No existing PRs found for ${pickBranch}`);
Expand All @@ -91,12 +119,7 @@ jobs:
reviewers: ["DanielRosenwasser", REQUESTING_USER],
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: +PR,
body: `Hey @${REQUESTING_USER}, I've created #${newPr.data.number} for you.`,
});
commentBody = `I've created #${newPr.data.number} for you.`;
}
else {
const existing = existingPulls.data[0];
Expand All @@ -109,23 +132,18 @@ jobs:
title,
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: +PR,
body: `Hey @${REQUESTING_USER}, I've updated #${existing.number} for you.`,
});
commentBody = `I've updated #${existing.number} for you.`;
}
- run: |
MESSAGE="Hey @$REQUESTING_USER, I was unable to cherry-pick this PR."
MESSAGE+=$'\n\n'
MESSAGE+="Check the logs at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
return commentBody;
gh pr comment "$PR" --repo ${{ github.repository }} --body "$MESSAGE"
if: ${{ failure() }}
env:
PR: ${{ inputs.pr || github.event.client_payload.pr }}
TARGET_BRANCH: ${{ inputs.target_branch || github.event.client_payload.target_branch }}
REQUESTING_USER: ${{ inputs.requesting_user || github.event.client_payload.requesting_user }}
GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
- uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master
if: ${{ !cancelled() && inputs.distinct_id }}
with:
success_comment: ${{ steps.open-pr.outputs.result }}
failure_comment: 'I was unable to cherry-pick this PR.'
github_token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
distinct_id: ${{ inputs.distinct_id }}
source_issue: ${{ inputs.source_issue }}
requesting_user: ${{ inputs.requesting_user }}
status_comment: ${{ inputs.status_comment }}
43 changes: 43 additions & 0 deletions .github/workflows/insiders.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish Insiders

on:
workflow_dispatch: {}
repository_dispatch:
types: [publish-insiders]

permissions:
contents: read

# Ensure scripts are run with pipefail. See:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'microsoft/TypeScript'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
# Use NODE_AUTH_TOKEN environment variable to authenticate to this registry.
registry-url: https://registry.npmjs.org/
- run: |
npm --version
# corepack enable npm
npm install -g $(jq -r '.packageManager' < package.json)
npm --version
- name: Setup and publish insiders
run: |
npm whoami
npm ci
npx hereby configure-insiders
npx hereby LKG
npx hereby runtests-parallel
npx hereby clean
npm publish --tag insiders
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
63 changes: 53 additions & 10 deletions .github/workflows/new-release-branch.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
name: New Release Branch

on:
repository_dispatch:
types: [new-release-branch]
workflow_dispatch:
inputs:
branch_name:
description: Release branch name to create
required: true
type: string
package_version:
description: Release package version
required: true
type: string
core_major_minor:
description: Release core major.minor version
required: true
type: string

# Inputs provided by the bot
distinct_id:
description: '(bot) A distinct ID'
required: false
default: ''
source_issue:
description: '(bot) The issue that triggered this workflow'
required: false
default: ''
requesting_user:
description: '(bot) The user who requested this workflow'
required: false
default: ''
status_comment:
description: '(bot) The comment to update with the status of this workflow'
required: false
default: ''

run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})', inputs.distinct_id) || '' }}

permissions:
contents: read
Expand Down Expand Up @@ -30,12 +62,12 @@ jobs:
npm install -g $(jq -r '.packageManager' < package.json)
npm --version
- run: |
git checkout -b ${{ github.event.client_payload.branch_name }}
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts
git checkout -b ${{ inputs.branch_name }}
sed -i -e 's/"version": ".*"/"version": "${{ inputs.package_version }}"/g' package.json
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ inputs.core_major_minor }}"/g' src/compiler/corePublic.ts
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ inputs.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ inputs.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ inputs.package_version }}" as string;/g' src/compiler/corePublic.ts
npm ci
npm install # update package-lock.json to ensure the version bump is included
npx hereby LKG
Expand All @@ -48,5 +80,16 @@ jobs:
git add --force ./lib
git config user.email "[email protected]"
git config user.name "TypeScript Bot"
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG'
git push --set-upstream origin ${{ github.event.client_payload.branch_name }}
git commit -m 'Bump version to ${{ inputs.package_version }} and LKG'
git push --set-upstream origin ${{ inputs.branch_name }}
- uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master
if: ${{ !cancelled() && inputs.distinct_id }}
with:
success_comment: "I've created ${{ inputs.branch_name }} with version ${{ inputs.package_version }} for you."
failure_comment: 'I was unable to create the new release branch.'
github_token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
distinct_id: ${{ inputs.distinct_id }}
source_issue: ${{ inputs.source_issue }}
requesting_user: ${{ inputs.requesting_user }}
status_comment: ${{ inputs.status_comment }}
2 changes: 0 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
- cron: '0 7 * * *'
# enable users to manually trigger with workflow_dispatch
workflow_dispatch: {}
repository_dispatch:
types: [publish-nightly]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@e675ced7a7522a761fc9c8eb26682c8b27c42b2b # v3.24.1
uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
with:
sarif_file: results.sarif
Loading

0 comments on commit 1bef75f

Please sign in to comment.