Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into numeric-constraint-ma…
Browse files Browse the repository at this point in the history
…pped-type-with-name-type
  • Loading branch information
Andarist committed Dec 28, 2023
2 parents b5c12ee + fbcdb8c commit b55610e
Show file tree
Hide file tree
Showing 1,065 changed files with 37,668 additions and 7,076 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/lib_change.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Library change'
description: 'Fix or improve issues with built-in type definitions like `lib.dom.d.ts`, `lib.es6.d.ts`, etc.'
description: 'Fix or improve issues with built-in type definitions like `lib.es6.d.ts`, etc.'
body:
- type: markdown
attributes:
Expand Down
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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/init@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/autobuild@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9

# ℹ️ 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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/analyze@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
131 changes: 131 additions & 0 deletions .github/workflows/create-cherry-pick-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Create cherry pick PR

on:
repository_dispatch:
types: [create-cherry-pick-pr]
workflow_dispatch:
inputs:
pr:
description: PR number to cherry-pick
required: true
type: number
target_branch:
description: Target branch to cherry-pick to
required: true
type: string
requesting_user:
description: User who requested the cherry-pick
required: true
type: string

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:
open-pr:
runs-on: ubuntu-latest
if: github.repository == 'microsoft/TypeScript'

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
filter: blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
fetch-depth: 0 # Default is 1; need to set to 0 to get the benefits of blob:none.
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}

- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
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 }}
with:
retries: 3
github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }}
script: |
const { PR, TARGET_BRANCH, REQUESTING_USER } = process.env;
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: +PR,
});
if (!pr.data.merge_commit_sha) throw new Error("No merge commit sha found");
const pickBranch = `cherry-pick/${PR}/${TARGET_BRANCH}`;
const title = `🤖 Pick PR #${PR} (${pr.data.title.substring(0, 35)}${pr.data.title.length > 35 ? "..." : ""}) into ${TARGET_BRANCH}`;
await exec.exec("git", ["config", "user.email", "[email protected]"]);
await exec.exec("git", ["config", "user.name", "TypeScript Bot"]);
await exec.exec("git", ["switch", "--detach", `origin/${TARGET_BRANCH}`]);
await exec.exec("git", ["switch", "-c", pickBranch]);
await exec.exec("git", ["cherry-pick", "-m", "1", pr.data.merge_commit_sha]);
await exec.exec("git", ["push", "--force", "--set-upstream", "origin", pickBranch]);
const existingPulls = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: `${context.repo.owner}:${pickBranch}`,
});
if (existingPulls.data.length === 0) {
console.log(`No existing PRs found for ${pickBranch}`);
const body = `This cherry-pick was triggered by a request on #${PR}.\n\nPlease review the diff and merge if no changes are unexpected.`;
const newPr = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
base: TARGET_BRANCH,
head: pickBranch,
title,
body,
assignees: ["DanielRosenwasser"],
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.`,
});
}
else {
const existing = existingPulls.data[0];
console.log(`Found existing PR #${existing.number} for ${pickBranch}`);
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: existing.number,
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.`,
});
}
- 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 }}"
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 }}
2 changes: 1 addition & 1 deletion .github/workflows/new-release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: New Release Branch

on:
repository_dispatch:
types: new-release-branch
types: [new-release-branch]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
# enable users to manually trigger with workflow_dispatch
workflow_dispatch: {}
repository_dispatch:
types: publish-nightly
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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/upload-sarif@c0d1daa7f7e14667747d73a7dbbe8c074bc8bfe2 # v2.22.9
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Set branch version

on:
repository_dispatch:
types: set-version
types: [set-version]

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Sync branch with master

on:
repository_dispatch:
types: sync-branch
types: [sync-branch]
workflow_dispatch:
inputs:
branch_name:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/twoslash-repros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
schedule:
- cron: '0 8 * * *'
repository_dispatch:
types: run-twoslash-repros
types: [run-twoslash-repros]
workflow_dispatch:
inputs:
issue:
Expand Down
Loading

0 comments on commit b55610e

Please sign in to comment.