From 5dce3ed75b8fb75c20743ccc5c80cd62bab8541b Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 9 Feb 2026 16:29:45 -0800 Subject: [PATCH] interpolation --- .github/workflows/ci.yml | 8 ++++++-- .github/workflows/close-issues.yml | 7 ++++--- .github/workflows/lkg.yml | 6 ++++-- .github/workflows/new-release-branch.yaml | 20 ++++++++++++-------- .github/workflows/pr-modified-files.yml | 15 +++++++++------ .github/workflows/set-version.yaml | 15 +++++++++------ 6 files changed, 44 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33061d075fb31..d56dbf833132d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,9 @@ jobs: - name: Tests id: test # run tests, but lint separately - run: npm run test -- --no-lint --bundle=${{ matrix.config.bundle }} + env: + BUNDLE: ${{ matrix.config.bundle }} + run: npm run test -- --no-lint --bundle="$BUNDLE" - name: Print baseline diff on failure if: ${{ failure() && steps.test.conclusion == 'failure' }} @@ -264,10 +266,12 @@ jobs: id: pack - name: Smoke test + env: + PACKAGE: ${{ steps.pack.outputs.package }} run: | cd "$(mktemp -d)" npm init --yes - npm install ${{ steps.pack.outputs.package }} + npm install "$PACKAGE" echo "Testing tsc..." npx tsc --version diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml index 8e8f54a0105b5..5c819fc636644 100644 --- a/.github/workflows/close-issues.yml +++ b/.github/workflows/close-issues.yml @@ -26,14 +26,15 @@ jobs: - name: Close issues env: GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + REPO: ${{ github.repository }} run: | DATE=$(date --date='2 days ago' --iso-8601) close_issues() { echo "Closing issues marked as '$1'." - for issue in $(gh issue list --limit 100 --label "$1" --repo ${{ github.repository }} --state open --search "updated:<$DATE" --json number --jq '.[].number'); do - echo "Closing https://github.com/${{ github.repository }}/issues/$issue" - gh issue close $issue --repo ${{ github.repository }} --reason "not planned" --comment "This issue has been marked as \"$1\" and has seen no recent activity. It has been automatically closed for house-keeping purposes." + for issue in $(gh issue list --limit 100 --label "$1" --repo "$REPO" --state open --search "updated:<$DATE" --json number --jq '.[].number'); do + echo "Closing https://github.com/$REPO/issues/$issue" + gh issue close $issue --repo "$REPO" --reason "not planned" --comment "This issue has been marked as \"$1\" and has seen no recent activity. It has been automatically closed for house-keeping purposes." done } diff --git a/.github/workflows/lkg.yml b/.github/workflows/lkg.yml index 5a3491d6c5e32..5195cd9c98646 100644 --- a/.github/workflows/lkg.yml +++ b/.github/workflows/lkg.yml @@ -21,8 +21,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - run: | - if [[ ! "${{ inputs.branch_name }}" =~ ^release- ]]; then + - env: + BRANCH_NAME: ${{ inputs.branch_name }} + run: | + if [[ ! "$BRANCH_NAME" =~ ^release- ]]; then echo "Branch name must start with 'release-'" exit 1 fi diff --git a/.github/workflows/new-release-branch.yaml b/.github/workflows/new-release-branch.yaml index 558162756c196..305b4361913f1 100644 --- a/.github/workflows/new-release-branch.yaml +++ b/.github/workflows/new-release-branch.yaml @@ -63,12 +63,16 @@ jobs: # corepack enable npm npm install -g $(jq -r '.packageManager' < package.json) npm --version - - run: | - 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 version\(: string\)\{0,1\} = .*;/const version = "${{ inputs.package_version }}" as string;/g' src/compiler/corePublic.ts + - env: + BRANCH_NAME: ${{ inputs.branch_name }} + PACKAGE_VERSION: ${{ inputs.package_version }} + CORE_MAJOR_MINOR: ${{ inputs.core_major_minor }} + run: | + git checkout -b "$BRANCH_NAME" + sed -i -e 's/"version": ".*"/"version": "'"$PACKAGE_VERSION"'"/g' package.json + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "'"$CORE_MAJOR_MINOR"'"/g' src/compiler/corePublic.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "'"$CORE_MAJOR_MINOR"'"/g' tests/baselines/reference/api/typescript.d.ts + sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "'"$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 @@ -80,8 +84,8 @@ jobs: git add --force ./lib git config user.email "typescriptbot@microsoft.com" git config user.name "TypeScript Bot" - git commit -m 'Bump version to ${{ inputs.package_version }} and LKG' - git push --set-upstream origin ${{ inputs.branch_name }} + git commit -m "Bump version to $PACKAGE_VERSION and LKG" + git push --set-upstream origin "$BRANCH_NAME" - uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master if: ${{ !cancelled() && inputs.distinct_id }} diff --git a/.github/workflows/pr-modified-files.yml b/.github/workflows/pr-modified-files.yml index e0d269dda7e0a..71f0aa908c85c 100644 --- a/.github/workflows/pr-modified-files.yml +++ b/.github/workflows/pr-modified-files.yml @@ -33,13 +33,16 @@ jobs: env: GH_TOKEN: ${{ secrets.TS_BOT_GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + REPO: ${{ github.repository }} steps: - 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 "${{ github.event.pull_request.user.login }}" pr_owners.txt; then + if grep -Fxq -m1 "$PR_AUTHOR" pr_owners.txt; then echo "pr_owner=true" >> "$GITHUB_OUTPUT" else echo "pr_owner=false" >> "$GITHUB_OUTPUT" @@ -57,7 +60,7 @@ jobs: gh api graphql -f query=' query($endCursor: String) { repository(owner: "microsoft", name: "TypeScript") { - pullRequest(number: ${{ github.event.pull_request.number }}) { + pullRequest(number: '"$PR_NUMBER"') { files(first: 100, after: $endCursor) { pageInfo{ hasNextPage, endCursor } nodes { @@ -79,7 +82,7 @@ jobs: #!/bin/bash FILENAME=bot_comments.txt if [ ! -f $FILENAME ]; then - gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} \ + gh pr view $PR_NUMBER --repo $REPO \ --json 'comments' --jq '.comments[] | select(.author.login == "typescript-bot") | .body' > $FILENAME fi exec grep -Fq -m1 "$1" $FILENAME @@ -99,7 +102,7 @@ jobs: 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 ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --comment "$MESSAGE" + gh pr close "$PR_NUMBER" --repo "$REPO" --comment "$MESSAGE" exit 1 # Stop the pipeline; we just closed the PR. fi @@ -114,7 +117,7 @@ jobs: if ./already_commented.sh "It looks like you've changed the TSServer protocol in some way."; then echo "Already commented." else - gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" + gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$MESSAGE" fi fi @@ -130,6 +133,6 @@ jobs: 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 ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "$MESSAGE" + gh pr comment "$PR_NUMBER" --repo "$REPO" --body "$MESSAGE" fi fi diff --git a/.github/workflows/set-version.yaml b/.github/workflows/set-version.yaml index 43729312642ff..387edc30f8ddb 100644 --- a/.github/workflows/set-version.yaml +++ b/.github/workflows/set-version.yaml @@ -68,11 +68,14 @@ jobs: # branch_name - the target branch # package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`) # core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`) - - run: | - 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 version\(: string\)\{0,1\} = .*;/const version = "${{ inputs.package_version }}" as string;/g' src/compiler/corePublic.ts + - env: + PACKAGE_VERSION: ${{ inputs.package_version }} + CORE_MAJOR_MINOR: ${{ inputs.core_major_minor }} + run: | + sed -i -e 's/"version": ".*"/"version": "'"$PACKAGE_VERSION"'"/g' package.json + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "'"$CORE_MAJOR_MINOR"'"/g' src/compiler/corePublic.ts + sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "'"$CORE_MAJOR_MINOR"'"/g' tests/baselines/reference/api/typescript.d.ts + sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "'"$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 @@ -84,7 +87,7 @@ jobs: git add --force ./lib git config user.email "typescriptbot@microsoft.com" git config user.name "TypeScript Bot" - git commit -m 'Bump version to ${{ inputs.package_version }} and LKG' + git commit -m "Bump version to $PACKAGE_VERSION and LKG" git push - uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master