diff --git a/.github/disabled-workflows/lkg.yml b/.github/disabled-workflows/lkg.yml deleted file mode 100644 index ba0b3b27b8379..0000000000000 --- a/.github/disabled-workflows/lkg.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Update LKG - -on: - workflow_dispatch: - inputs: - branch_name: - description: Release branch name to LKG - required: true - type: string - -permissions: - contents: read - id-token: write - -# 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 - environment: - name: azure - deployment: false - steps: - - env: - BRANCH_NAME: ${{ inputs.branch_name }} - run: | - if [[ ! "$BRANCH_NAME" =~ ^release- ]]; then - echo "Branch name must start with 'release-'" - exit 1 - fi - - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - ref: ${{ inputs.branch_name }} - persist-credentials: false - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 'lts/*' - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - run: | - npm ci - npx hereby LKG - git add --force ./lib - git config user.email "290192711+typescript-automation[bot]@users.noreply.github.com" - git config user.name "typescript-automation[bot]" - git commit -m 'Update LKG' - - uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 - with: - client-id: ${{ vars.AZURE_CLIENT_ID }} - tenant-id: ${{ vars.AZURE_TENANT_ID }} - subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - - name: Create GitHub App token - id: app-token - uses: microsoft/create-github-app-token-via-key-vault@5ba0d436e9c3cac52feff4d1f2f66f9698ce4a2d # v1 - with: - client-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID }} - key-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID }} - owner: microsoft - repositories: TypeScript - permission-contents: write - - name: Configure git for GitHub App token - shell: bash - env: - GITHUB_APP_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - set -euo pipefail - basic_auth="$(node -e 'process.stdout.write(Buffer.from("x-access-token:" + process.env.GITHUB_APP_TOKEN).toString("base64"))')" - echo "::add-mask::$basic_auth" - git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${basic_auth}" - - run: git push diff --git a/.github/disabled-workflows/pr-modified-files.yml b/.github/disabled-workflows/pr-modified-files.yml deleted file mode 100644 index 19b19c200668c..0000000000000 --- a/.github/disabled-workflows/pr-modified-files.yml +++ /dev/null @@ -1,165 +0,0 @@ -name: Check modified files -on: - # For security reasons, we have to use pull_request_target here. - # This differs from pull_request in that it runs at the _base_ of the PR, - # e.g. main. This allows us to access secrets. In this workflow, we should - # never actually clone the PR, as it may contain malicious code. - # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ - pull_request_target: - branches: - - main - -# We only ever need one of these running on a single PR. -# Just let the newest one complete if there are multiple running. -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - id-token: write - -# 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: - manage-prs: - runs-on: ubuntu-latest - environment: - name: azure - deployment: false - if: github.repository == 'microsoft/TypeScript' - - # No need to set explicit permissions; we are using the GitHub App token, not github-actions' token. - - env: - PR_NUMBER: ${{ github.event.pull_request.number }} - PR_AUTHOR: ${{ github.event.pull_request.user.login }} - REPO: ${{ github.repository }} - - steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - with: - persist-credentials: false - - uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 - with: - client-id: ${{ vars.AZURE_CLIENT_ID }} - tenant-id: ${{ vars.AZURE_TENANT_ID }} - subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - - name: Create GitHub App token - id: app-token - uses: microsoft/create-github-app-token-via-key-vault@5ba0d436e9c3cac52feff4d1f2f66f9698ce4a2d # v1 - with: - client-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID }} - key-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID }} - owner: microsoft - repositories: TypeScript - permission-issues: write - permission-pull-requests: write - - name: Check if PR author is in pr_owners.txt - id: pr_owner - run: | - curl -s https://raw.githubusercontent.com/microsoft/TypeScript/main/.github/pr_owners.txt > pr_owners.txt - if grep -Fxq -m1 "$PR_AUTHOR" pr_owners.txt; then - echo "pr_owner=true" >> "$GITHUB_OUTPUT" - else - echo "pr_owner=false" >> "$GITHUB_OUTPUT" - fi - - - name: Create scripts - run: | - cat > is_changed.sh <<'EOF' - #!/bin/bash - FILENAME=changed_files.txt - if [ ! -f $FILENAME ]; then - # The gh command only returns info for the first 100 files. To get - # the rest, we have to use the graphql API. See: - # https://github.com/cli/cli/issues/5368#issuecomment-1344253654 - gh api graphql -f query=' - query($endCursor: String) { - repository(owner: "microsoft", name: "TypeScript") { - pullRequest(number: '"$PR_NUMBER"') { - files(first: 100, after: $endCursor) { - pageInfo{ hasNextPage, endCursor } - nodes { - path - } - } - } - } - }' --paginate --jq '.data.repository.pullRequest.files.nodes.[].path' > $FILENAME - fi - for file in "$@"; do - grep -Fxq -m1 "$file" $FILENAME && exit 0 - done - exit 1 - EOF - chmod +x is_changed.sh - - cat > already_commented.sh <<'EOF' - #!/bin/bash - FILENAME=bot_comments.txt - if [ ! -f $FILENAME ]; then - gh pr view $PR_NUMBER --repo $REPO \ - --json 'comments' --jq '.comments[] | select(.author.login == "typescript-bot" or .author.login == "typescript-automation[bot]") | .body' > $FILENAME - fi - exec grep -Fq -m1 "$1" $FILENAME - EOF - chmod +x already_commented.sh - - - name: Generated DOM files - if: steps.pr_owner.outputs.pr_owner == 'false' - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - if ./is_changed.sh "src/lib/dom.generated.d.ts" \ - "src/lib/dom.iterable.generated.d.ts" \ - "src/lib/webworker.generated.d.ts" \ - "src/lib/webworker.iterable.generated.d.ts"; then - MESSAGE="It looks like you've sent a pull request to update some generated declaration files related to the DOM." - MESSAGE+=" These files aren't meant to be edited by hand, as they are synchronized with files in" - MESSAGE+=" [the TypeScript-DOM-lib-generator repository](https://github.com/microsoft/TypeScript-DOM-lib-generator)." - MESSAGE+=" You can [read more here](https://github.com/microsoft/TypeScript/blob/main/CONTRIBUTING.md#contributing-libdts-fixes)." - MESSAGE+=" For house-keeping purposes, this pull request will be closed." - - gh pr close "$PR_NUMBER" --repo "$REPO" --comment "$MESSAGE" - exit 1 # Stop the pipeline; we just closed the PR. - fi - - - name: Check if PR modifies protocol.ts - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - if ./is_changed.sh "src/server/protocol.ts"; then - MESSAGE="Thanks for the PR! It looks like you've changed the TSServer protocol in some way." - MESSAGE+=" Please ensure that any changes here don't break consumers of the current TSServer API." - MESSAGE+=" For some extra review, we'll ping @sheetalkamat, @mjbvz, and @joj for you." - MESSAGE+=" Feel free to loop in other consumers/maintainers if necessary." - - if ./already_commented.sh "It looks like you've changed the TSServer protocol in some way."; then - echo "Already commented." - else - gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$MESSAGE" - fi - fi - - - name: Check for breaking changes - env: - GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - if ./is_changed.sh "tests/baselines/reference/api/typescript.d.ts"; then - MESSAGE="Looks like you're introducing a change to the public API surface area." - MESSAGE+=" If this includes breaking changes, please document them" - MESSAGE+=" [on our wiki's API Breaking Changes page](https://github.com/microsoft/TypeScript/wiki/API-Breaking-Changes)." - MESSAGE+=$'\n\n' - MESSAGE+="Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up." - - if ./already_commented.sh "Looks like you're introducing a change to the public API surface area."; then - echo "Already commented." - else - gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$MESSAGE" - fi - fi diff --git a/.github/disabled-workflows/release-branch-artifact.yaml b/.github/disabled-workflows/release-branch-artifact.yaml deleted file mode 100644 index 42a50cba8f864..0000000000000 --- a/.github/disabled-workflows/release-branch-artifact.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: Create Releasable Package Drop - -on: - push: - branches: - - release-* - -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 - - steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 'lts/*' - - run: | - npm --version - # corepack enable npm - npm install -g $(jq -r '.packageManager' < package.json) - npm --version - - name: npm install and test - run: | - npm ci - npm test - - name: Installing browsers - run: npx playwright install --with-deps - - name: Validate the browser can import TypeScript - run: npx hereby test-browser-integration - - name: LKG, clean, and pack - run: | - npx hereby LKG - npx hereby clean - node ./scripts/addPackageJsonGitHead.mjs package.json - npm pack ./ - mv typescript-*.tgz typescript.tgz - - name: Upload built tarfile - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 - with: - name: tgz - path: typescript.tgz