Skip to content

Commit 8030e75

Browse files
committed
Merge remote-tracking branch 'origin/main' into narrow-down-non-const-entity-name-expressions-in-element-accesses
2 parents 5511b1b + fbcdb8c commit 8030e75

File tree

1,057 files changed

+37236
-7070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,057 files changed

+37236
-7070
lines changed

.github/ISSUE_TEMPLATE/lib_change.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Library change'
2-
description: 'Fix or improve issues with built-in type definitions like `lib.dom.d.ts`, `lib.es6.d.ts`, etc.'
2+
description: 'Fix or improve issues with built-in type definitions like `lib.es6.d.ts`, etc.'
33
body:
44
- type: markdown
55
attributes:

.github/workflows/codeql.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
49+
uses: github/codeql-action/init@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
5050
with:
5151
config-file: ./.github/codeql/codeql-configuration.yml
5252
# Override language selection by uncommenting this and choosing your languages
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below).
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
59+
uses: github/codeql-action/autobuild@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
6060

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

7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
73+
uses: github/codeql-action/analyze@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Create cherry pick PR
2+
3+
on:
4+
repository_dispatch:
5+
types: [create-cherry-pick-pr]
6+
workflow_dispatch:
7+
inputs:
8+
pr:
9+
description: PR number to cherry-pick
10+
required: true
11+
type: number
12+
target_branch:
13+
description: Target branch to cherry-pick to
14+
required: true
15+
type: string
16+
requesting_user:
17+
description: User who requested the cherry-pick
18+
required: true
19+
type: string
20+
21+
permissions:
22+
contents: read
23+
24+
# Ensure scripts are run with pipefail. See:
25+
# https://docs.github.com./en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
open-pr:
32+
runs-on: ubuntu-latest
33+
if: github.repository == 'microsoft/TypeScript'
34+
35+
steps:
36+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
37+
with:
38+
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
39+
fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none.
40+
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
41+
42+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
43+
env:
44+
PR: ${{ inputs.pr || github.event.client_payload.pr }}
45+
TARGET_BRANCH: ${{ inputs.target_branch || github.event.client_payload.target_branch }}
46+
REQUESTING_USER: ${{ inputs.requesting_user || github.event.client_payload.requesting_user }}
47+
with:
48+
retries: 3
49+
github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
50+
script: |
51+
const { PR, TARGET_BRANCH, REQUESTING_USER } = process.env;
52+
53+
const pr = await github.rest.pulls.get({
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
pull_number: +PR,
57+
});
58+
59+
if (!pr.data.merge_commit_sha) throw new Error("No merge commit sha found");
60+
61+
const pickBranch = `cherry-pick/${PR}/${TARGET_BRANCH}`;
62+
63+
const title = `🤖 Pick PR #${PR} (${pr.data.title.substring(0, 35)}${pr.data.title.length > 35 ? "..." : ""}) into ${TARGET_BRANCH}`;
64+
65+
await exec.exec("git", ["config", "user.email", "[email protected]"]);
66+
await exec.exec("git", ["config", "user.name", "TypeScript Bot"]);
67+
await exec.exec("git", ["switch", "--detach", `origin/${TARGET_BRANCH}`]);
68+
await exec.exec("git", ["switch", "-c", pickBranch]);
69+
await exec.exec("git", ["cherry-pick", "-m", "1", pr.data.merge_commit_sha]);
70+
await exec.exec("git", ["push", "--force", "--set-upstream", "origin", pickBranch]);
71+
72+
const existingPulls = await github.rest.pulls.list({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
head: `${context.repo.owner}:${pickBranch}`,
76+
});
77+
78+
if (existingPulls.data.length === 0) {
79+
console.log(`No existing PRs found for ${pickBranch}`);
80+
81+
const body = `This cherry-pick was triggered by a request on #${PR}.\n\nPlease review the diff and merge if no changes are unexpected.`;
82+
83+
const newPr = await github.rest.pulls.create({
84+
owner: context.repo.owner,
85+
repo: context.repo.repo,
86+
base: TARGET_BRANCH,
87+
head: pickBranch,
88+
title,
89+
body,
90+
assignees: ["DanielRosenwasser"],
91+
reviewers: ["DanielRosenwasser", REQUESTING_USER],
92+
});
93+
94+
await github.rest.issues.createComment({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
issue_number: +PR,
98+
body: `Hey @${REQUESTING_USER}, I've created #${newPr.data.number} for you.`,
99+
});
100+
}
101+
else {
102+
const existing = existingPulls.data[0];
103+
console.log(`Found existing PR #${existing.number} for ${pickBranch}`);
104+
105+
await github.rest.pulls.update({
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
pull_number: existing.number,
109+
title,
110+
});
111+
112+
await github.rest.issues.createComment({
113+
owner: context.repo.owner,
114+
repo: context.repo.repo,
115+
issue_number: +PR,
116+
body: `Hey @${REQUESTING_USER}, I've updated #${existing.number} for you.`,
117+
});
118+
}
119+
120+
- run: |
121+
MESSAGE="Hey @$REQUESTING_USER, I was unable to cherry-pick this PR."
122+
MESSAGE+=$'\n\n'
123+
MESSAGE+="Check the logs at: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
124+
125+
gh pr comment "$PR" --repo ${{ github.repository }} --body "$MESSAGE"
126+
if: ${{ failure() }}
127+
env:
128+
PR: ${{ inputs.pr || github.event.client_payload.pr }}
129+
TARGET_BRANCH: ${{ inputs.target_branch || github.event.client_payload.target_branch }}
130+
REQUESTING_USER: ${{ inputs.requesting_user || github.event.client_payload.requesting_user }}
131+
GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }}

.github/workflows/new-release-branch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: New Release Branch
22

33
on:
44
repository_dispatch:
5-
types: new-release-branch
5+
types: [new-release-branch]
66

77
permissions:
88
contents: read

.github/workflows/nightly.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
# enable users to manually trigger with workflow_dispatch
77
workflow_dispatch: {}
88
repository_dispatch:
9-
types: publish-nightly
9+
types: [publish-nightly]
1010

1111
permissions:
1212
contents: read

.github/workflows/scorecard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ jobs:
5555

5656
# Upload the results to GitHub's code scanning dashboard.
5757
- name: 'Upload to code-scanning'
58-
uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
58+
uses: github/codeql-action/upload-sarif@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
5959
with:
6060
sarif_file: results.sarif

.github/workflows/set-version.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Set branch version
22

33
on:
44
repository_dispatch:
5-
types: set-version
5+
types: [set-version]
66

77
permissions:
88
contents: read

.github/workflows/sync-branch.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Sync branch with master
22

33
on:
44
repository_dispatch:
5-
types: sync-branch
5+
types: [sync-branch]
66
workflow_dispatch:
77
inputs:
88
branch_name:

.github/workflows/twoslash-repros.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
schedule:
88
- cron: '0 8 * * *'
99
repository_dispatch:
10-
types: run-twoslash-repros
10+
types: [run-twoslash-repros]
1111
workflow_dispatch:
1212
inputs:
1313
issue:

0 commit comments

Comments
 (0)