-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Refactor workflows for new typescript-bot triggers #57409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c2331e7
Refactor workflows for new typescript-bot triggers
jakebailey 1f889ac
Fix typos
jakebailey 47a6057
Fix failure
jakebailey b317453
Change ref to main
jakebailey 39ebbf7
Don't retry forever
jakebailey 0c28c44
Merge branch 'main' into new-workflows
jakebailey f085492
Fix
jakebailey f0cf6ed
Fix
jakebailey 24e7a71
Fix
jakebailey 60bb250
move action to triggerer repo
jakebailey 26d0c45
Use a return in script
jakebailey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
name: New Release Branch | ||
|
||
on: | ||
repository_dispatch: | ||
types: [new-release-branch] | ||
workflow_dispatch: | ||
inputs: | ||
branch_name: | ||
description: Release branch name to create | ||
required: true | ||
type: number | ||
package_version: | ||
description: Release package version | ||
required: true | ||
type: string | ||
core_major_minor: | ||
description: Release core major.minor version | ||
required: true | ||
type: string | ||
|
||
# Inputs provided by the bot | ||
distinct_id: | ||
description: '(bot) A distinct ID' | ||
required: false | ||
default: '' | ||
source_issue: | ||
description: '(bot) The issue that triggered this workflow' | ||
required: false | ||
default: '' | ||
requesting_user: | ||
description: '(bot) The user who requested this workflow' | ||
required: false | ||
default: '' | ||
status_comment: | ||
description: '(bot) The comment to update with the status of this workflow' | ||
required: false | ||
default: '' | ||
|
||
run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})', inputs.distinct_id) || '' }} | ||
|
||
permissions: | ||
contents: read | ||
|
@@ -30,12 +62,12 @@ jobs: | |
npm install -g $(jq -r '.packageManager' < package.json) | ||
npm --version | ||
- run: | | ||
git checkout -b ${{ github.event.client_payload.branch_name }} | ||
sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts | ||
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts | ||
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 versionMajorMinor = ".*"/const versionMajorMinor = "${{ inputs.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts | ||
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ inputs.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 | ||
|
@@ -48,5 +80,16 @@ jobs: | |
git add --force ./lib | ||
git config user.email "[email protected]" | ||
git config user.name "TypeScript Bot" | ||
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' | ||
git push --set-upstream origin ${{ github.event.client_payload.branch_name }} | ||
git commit -m 'Bump version to ${{ inputs.package_version }} and LKG' | ||
git push --set-upstream origin ${{ inputs.branch_name }} | ||
|
||
- uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master | ||
if: ${{ !cancelled() && inputs.distinct_id }} | ||
with: | ||
success_comment: "I've created ${{ inputs.branch_name }} with version ${{ inputs.package_version }} for you." | ||
failure_comment: 'I was unable to create the new release branch.' | ||
github_token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} | ||
distinct_id: ${{ inputs.distinct_id }} | ||
source_issue: ${{ inputs.source_issue }} | ||
requesting_user: ${{ inputs.requesting_user }} | ||
status_comment: ${{ inputs.status_comment }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
name: Set branch version | ||
|
||
on: | ||
repository_dispatch: | ||
types: [set-version] | ||
workflow_dispatch: | ||
inputs: | ||
branch_name: | ||
description: Release branch name to create | ||
required: true | ||
type: number | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, too. |
||
package_version: | ||
description: Release package version | ||
required: true | ||
type: string | ||
core_major_minor: | ||
description: Release core major.minor version | ||
required: true | ||
type: string | ||
|
||
# Inputs provided by the bot | ||
distinct_id: | ||
description: '(bot) A distinct ID' | ||
required: false | ||
default: '' | ||
source_issue: | ||
description: '(bot) The issue that triggered this workflow' | ||
required: false | ||
default: '' | ||
requesting_user: | ||
description: '(bot) The user who requested this workflow' | ||
required: false | ||
default: '' | ||
status_comment: | ||
description: '(bot) The comment to update with the status of this workflow' | ||
required: false | ||
default: '' | ||
|
||
run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})', inputs.distinct_id) || '' }} | ||
|
||
permissions: | ||
contents: read | ||
|
@@ -19,7 +51,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.event.client_payload.branch_name }} | ||
ref: ${{ inputs.branch_name }} | ||
token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} | ||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
- run: | | ||
|
@@ -35,11 +67,11 @@ jobs: | |
# 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": "${{ github.event.client_payload.package_version }}"/g' package.json | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/typescript.d.ts | ||
sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts | ||
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ github.event.client_payload.package_version }}" as string;/g' src/compiler/corePublic.ts | ||
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 versionMajorMinor = ".*"/const versionMajorMinor = "${{ inputs.core_major_minor }}"/g' tests/baselines/reference/api/tsserverlibrary.d.ts | ||
sed -i -e 's/const version\(: string\)\{0,1\} = .*;/const version = "${{ inputs.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 | ||
|
@@ -52,5 +84,16 @@ jobs: | |
git add --force ./lib | ||
git config user.email "[email protected]" | ||
git config user.name "TypeScript Bot" | ||
git commit -m 'Bump version to ${{ github.event.client_payload.package_version }} and LKG' | ||
git commit -m 'Bump version to ${{ inputs.package_version }} and LKG' | ||
git push | ||
|
||
- uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master | ||
if: ${{ !cancelled() && inputs.distinct_id }} | ||
with: | ||
success_comment: "I've set the version of ${{ inputs.branch_name }} to ${{ inputs.package_version }} for you." | ||
failure_comment: 'I was unable set the version.' | ||
github_token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} | ||
distinct_id: ${{ inputs.distinct_id }} | ||
source_issue: ${{ inputs.source_issue }} | ||
requesting_user: ${{ inputs.requesting_user }} | ||
status_comment: ${{ inputs.status_comment }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,32 @@ | ||
name: Sync branch with master | ||
|
||
on: | ||
repository_dispatch: | ||
types: [sync-branch] | ||
workflow_dispatch: | ||
inputs: | ||
branch_name: | ||
description: 'Target Branch Name' | ||
description: Release branch name to create | ||
required: true | ||
type: number | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here. |
||
|
||
# Inputs provided by the bot | ||
distinct_id: | ||
description: '(bot) A distinct ID' | ||
required: false | ||
default: '' | ||
source_issue: | ||
description: '(bot) The issue that triggered this workflow' | ||
required: false | ||
default: '' | ||
requesting_user: | ||
description: '(bot) The user who requested this workflow' | ||
required: false | ||
default: '' | ||
status_comment: | ||
description: '(bot) The comment to update with the status of this workflow' | ||
required: false | ||
default: '' | ||
|
||
run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})', inputs.distinct_id) || '' }} | ||
|
||
permissions: | ||
contents: read | ||
|
@@ -26,7 +45,7 @@ jobs: | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }} | ||
ref: ${{ inputs.branch_name }} | ||
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 }} | ||
|
@@ -42,3 +61,14 @@ jobs: | |
git add --force ./lib | ||
git commit -m 'Update LKG' | ||
git push | ||
|
||
- uses: microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master | ||
if: ${{ !cancelled() && inputs.distinct_id }} | ||
with: | ||
success_comment: "I've pulled main into ${{ inputs.branch_name }} for you." | ||
failure_comment: 'I was unable merge main into ${{ inputs.branch_name }}.' | ||
github_token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} | ||
distinct_id: ${{ inputs.distinct_id }} | ||
source_issue: ${{ inputs.source_issue }} | ||
requesting_user: ${{ inputs.requesting_user }} | ||
status_comment: ${{ inputs.status_comment }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
string
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're totally right, copy paste error, blah