Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/close-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/new-release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/pr-modified-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
15 changes: 9 additions & 6 deletions .github/workflows/set-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down