Skip to content
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

Merge main into releases/v2 #1511

Merged
merged 96 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
cdb9019
Support determining Dotcom CLI version from feature flags
henrymercer Jan 5, 2023
a6dff04
Ignore default version flags with invalid version numbers
henrymercer Jan 5, 2023
a76fe4f
Enable mapping from CLI version to bundle tag name
henrymercer Jan 6, 2023
bd2f52f
Move CodeQL setup to its own file
henrymercer Jan 9, 2023
c3be36f
Use new default version to set up CodeQL
henrymercer Jan 10, 2023
23d151d
Add test for using default version with no requested URL on Dotcom
henrymercer Jan 10, 2023
2f7b9a1
Differentiate `setupCodeql.setupCodeQL` from `codeql.setupCodeQL`
henrymercer Jan 11, 2023
e8c12e1
Add a debug log for the feature flag API response
henrymercer Jan 11, 2023
648838c
Allow using a `x.y.z-yyyymmdd` toolcache version for CLI `x.y.z`.
henrymercer Jan 12, 2023
1eeb9df
Remove dead code
henrymercer Jan 12, 2023
a89ad76
Expand note about defaults.json compatibility
henrymercer Jan 12, 2023
31c7ce1
Add doc describing CLI version marker files
henrymercer Jan 12, 2023
9578699
Merge branch 'main' into henrymercer/controlled-switchover
henrymercer Jan 12, 2023
28f827a
Add changelog notes
henrymercer Jan 12, 2023
c9b1be5
Bump version to 2.2.0
henrymercer Jan 12, 2023
c2e39e0
Cache explicitly requested bundles with their URL if possible
henrymercer Jan 12, 2023
33206d2
Include the bundle version in the toolcache version number
henrymercer Jan 12, 2023
0be20e5
Use the CLI version when caching the bundle in telemetry too
henrymercer Jan 12, 2023
12998b7
Convert logger call to debug
henrymercer Jan 13, 2023
13cdac3
Improve changelog notes
henrymercer Jan 13, 2023
eca06a5
Further improve changelog notes
henrymercer Jan 13, 2023
ac7e4d7
Improve changelog note some more
henrymercer Jan 16, 2023
115587a
Merge branch 'main' into henrymercer/controlled-switchover
henrymercer Jan 16, 2023
b660a38
Address review comments
henrymercer Jan 16, 2023
a5b44c1
Add a sentence on recommended practices for using the CLI
henrymercer Jan 16, 2023
218d40d
Remove v1 only parts of release script
henrymercer Jan 16, 2023
e0b20ee
Migrate release script to template strings
henrymercer Jan 16, 2023
ba674fb
Update release workflow
henrymercer Jan 16, 2023
5fe1a9b
Update mergeback workflow
henrymercer Jan 16, 2023
e530813
Remove PR checks for v1
henrymercer Jan 16, 2023
5f1362d
Merge branch 'main' into henrymercer/controlled-switchover
henrymercer Jan 18, 2023
8a4abfd
Support `cli-version-x.y.z-pre.txt` marker files
henrymercer Jan 18, 2023
3d62f02
Update changelog note
henrymercer Jan 18, 2023
bb36dc4
Update changelog and version after v2.1.39
invalid-email-address Jan 18, 2023
6d37d75
Update checked-in dependencies
invalid-email-address Jan 18, 2023
16d8967
Merge pull request #1490 from github/mergeback/v2.1.39-to-main-a34ca99b
henrymercer Jan 18, 2023
48ae299
Merge pull request #1482 from github/henrymercer/remove-v1-from-relea…
henrymercer Jan 18, 2023
40a7518
Merge pull request #1483 from github/henrymercer/remove-v1-checks
henrymercer Jan 18, 2023
5f644f9
Upgrade TypeScript to 9.2.0
henrymercer Jan 18, 2023
10695e6
Fix linter errors
henrymercer Jan 18, 2023
ed9506b
Bump `eslint-plugin-import` to avoid vulnerability in dependency
henrymercer Jan 18, 2023
0a11e3f
Bump packages to fix linter
henrymercer Jan 18, 2023
d5dcff5
Remove Node 12 compatibility check
henrymercer Jan 18, 2023
4306b97
Add a `.DS_Store` file shipped with a dependency
henrymercer Jan 18, 2023
9012214
Merge branch 'main' into henrymercer/controlled-switchover
henrymercer Jan 18, 2023
60e5868
Merge pull request #1475 from github/henrymercer/controlled-switchover
henrymercer Jan 19, 2023
ba93815
Merge branch 'main' into henrymercer/upgrade-typescript
henrymercer Jan 19, 2023
68a2486
Update CHANGELOG.md with new limits on uploading SARIF
aeisenberg Jan 19, 2023
b61b299
Immediately unref timers to avoid waiting for them before exit
henrymercer Jan 19, 2023
ffb06d7
Add changelog note
henrymercer Jan 19, 2023
85f0d84
Use a more Promise-oriented approach for the timeout system
henrymercer Jan 19, 2023
cb9be70
Install `@types/uuid` and eliminate a cast
henrymercer Jan 20, 2023
1b50895
Remove `checkActionVersion`
henrymercer Jan 20, 2023
be8f7b0
Add types for `package.json` via `@schemastore/package`
henrymercer Jan 20, 2023
4beb395
Explain why we're using `--format=json` to get the extractor path
henrymercer Jan 20, 2023
2014c85
Increase strictness of tool caching threshold to avoid caching nightlies
henrymercer Jan 20, 2023
291cc75
Add test case
henrymercer Jan 20, 2023
4827181
Merge pull request #1492 from github/henrymercer/upgrade-typescript
henrymercer Jan 20, 2023
4dc41e1
Update CHANGELOG.md
aeisenberg Jan 20, 2023
8e4a1d6
Merge branch 'main' into henrymercer/avoid-waiting-for-timeout
henrymercer Jan 20, 2023
6456115
Merge pull request #1494 from github/henrymercer/avoid-waiting-for-ti…
henrymercer Jan 20, 2023
54f4ea7
Merge branch 'main' into henrymercer/no-cache-nightlies
henrymercer Jan 20, 2023
42fb057
Update CHANGELOG.md
aeisenberg Jan 20, 2023
421a1b3
Merge pull request #1496 from github/henrymercer/no-cache-nightlies
henrymercer Jan 20, 2023
d37dce2
Bump default CodeQL version to 2.12.1
henrymercer Jan 23, 2023
e05bd5a
Use CodeQL path from `init` Action in Windows Python deps PR checks
henrymercer Jan 23, 2023
64580b3
Update workflow name to reflect Windows tests
henrymercer Jan 23, 2023
5794d96
Merge pull request #1502 from github/henrymercer/python-packages-use-…
henrymercer Jan 23, 2023
f9ae0b9
Merge branch 'main' into henrymercer/codeql-cli-2.12.1
henrymercer Jan 23, 2023
fe9baed
Fix typo in CHANGELOG.md
aeisenberg Jan 23, 2023
604a6c3
Merge branch 'main' into aeisenberg/upload-sarif-limits
aeisenberg Jan 23, 2023
78f2db8
Bump @octokit/plugin-retry from 3.0.9 to 4.0.4
dependabot[bot] Jan 23, 2023
45eb0a6
Update checked-in dependencies
invalid-email-address Jan 23, 2023
05d21ed
Merge pull request #1501 from github/henrymercer/codeql-cli-2.12.1
henrymercer Jan 23, 2023
90bbfad
Fail `prepare-test` early when `gh release list` fails
henrymercer Jan 23, 2023
66ed6f4
Merge pull request #1503 from github/dependabot/npm_and_yarn/octokit/…
henrymercer Jan 23, 2023
b873a18
Limit Swift autobuild runtime to 10 minutes
henrymercer Jan 23, 2023
5da183d
Bump npm to v9.2.0
henrymercer Jan 23, 2023
ebdd5a0
Remove `perf_hooks` Node 12 comment
henrymercer Jan 23, 2023
14c4412
Merge pull request #1506 from github/henrymercer/prepare-test-fail-early
henrymercer Jan 23, 2023
6b17e95
Bump @octokit/types from 8.0.0 to 9.0.0
dependabot[bot] Jan 23, 2023
5d931ea
Fall back to the default.json CLI version if feature flags misconfigured
henrymercer Jan 23, 2023
71109ec
Update checked-in dependencies
invalid-email-address Jan 23, 2023
fa47d5a
Merge pull request #1505 from github/henrymercer/more-node-12-cleanup
henrymercer Jan 23, 2023
824a20f
Merge pull request #1507 from github/henrymercer/swift-autobuild-timeout
henrymercer Jan 23, 2023
af42a70
Merge pull request #1504 from github/dependabot/npm_and_yarn/octokit/…
henrymercer Jan 24, 2023
8840544
Merge branch 'main' into aeisenberg/upload-sarif-limits
aeisenberg Jan 24, 2023
fdff4b0
Update CHANGELOG.md
aeisenberg Jan 24, 2023
a58e90a
Merge pull request #1508 from github/henrymercer/default-version-fall…
henrymercer Jan 24, 2023
ebf6415
Merge pull request #1493 from github/aeisenberg/upload-sarif-limits
aeisenberg Jan 25, 2023
24ca6b0
Send tools telemetry to `init` status report (#1497)
angelapwen Jan 25, 2023
0a9e9db
Add failing regression test
henrymercer Jan 26, 2023
75ae065
Fix computation of fallback version
henrymercer Jan 26, 2023
43f1a6c
Merge pull request #1510 from github/henrymercer/fix-fallback-version…
henrymercer Jan 26, 2023
f6d03f4
Update changelog for v2.2.0
invalid-email-address Jan 26, 2023
d966969
Remove $ from version number
henrymercer Jan 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
15 changes: 13 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"rules": {
"filenames/match-regex": ["error", "^[a-z0-9-]+(\\.test)?$"],
"i18n-text/no-en": "off",
"import/extensions": "error",
"import/extensions": ["error", {
// Allow importing JSON files
"json": {}
}],
"import/no-amd": "error",
"import/no-commonjs": "error",
"import/no-dynamic-require": "error",
Expand Down Expand Up @@ -55,5 +58,13 @@
"func-style": "off",
"sort-imports": "off"
}
}]
}],
"settings": {
"import/resolver": {
"node": {
"moduleDirectory": ["node_modules", "src"]
},
"typescript": {}
}
}
}
6 changes: 5 additions & 1 deletion .github/prepare-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: "Prepare test"
description: Performs some preparation to run tests
inputs:
version:
description: "The version of the CodeQL CLI to use. Can be 'latest', 'cached', 'nightly-latest', 'nightly-YYYY-MM-DD', or 'stable-YYYY-MM-DD'."
required: true
outputs:
tools-url:
description: "The value that should be passed as the 'tools' input of the 'init' step."
value: ${{ steps.get-url.outputs.tools-url }}
runs:
using: composite
Expand All @@ -20,6 +22,7 @@ runs:
name: Determine URL
shell: bash
run: |
set -e # Fail this Action if `gh release list` fails.
if [[ ${{ inputs.version }} == "nightly-latest" ]]; then
export LATEST=`gh release list --repo dsp-testing/codeql-cli-nightlies -L 1 | cut -f 3`
echo "tools-url=https://github.com/dsp-testing/codeql-cli-nightlies/releases/download/$LATEST/codeql-bundle.tar.gz" >> $GITHUB_OUTPUT
Expand All @@ -34,5 +37,6 @@ runs:
elif [[ ${{ inputs.version }} == "cached" ]]; then
echo "tools-url=" >> $GITHUB_OUTPUT
else
echo "::error Unrecognized version specified!"
echo "::error::Unrecognized version specified!"
exit 1
fi
180 changes: 38 additions & 142 deletions .github/update-release-branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@

"""

# Value of the mode flag for a v1 release
V1_MODE = 'v1-release'

# Value of the mode flag for a v2 release
V2_MODE = 'v2-release'

SOURCE_BRANCH_FOR_MODE = { V1_MODE: 'releases/v2', V2_MODE: 'main' }
TARGET_BRANCH_FOR_MODE = { V1_MODE: 'releases/v1', V2_MODE: 'releases/v2' }
SOURCE_BRANCH = 'main'
TARGET_BRANCH = 'releases/v2'

# Name of the remote
ORIGIN = 'origin'
Expand All @@ -32,39 +26,37 @@ def run_git(*args, allow_non_zero_exit_code=False):
cmd = ['git', *args]
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if not allow_non_zero_exit_code and p.returncode != 0:
raise Exception('Call to ' + ' '.join(cmd) + ' exited with code ' + str(p.returncode) + ' stderr:' + p.stderr.decode('ascii'))
raise Exception(f'Call to {" ".join(cmd)} exited with code {p.returncode} stderr: {p.stderr.decode("ascii")}.')
return p.stdout.decode('ascii')

# Returns true if the given branch exists on the origin remote
def branch_exists_on_remote(branch_name):
return run_git('ls-remote', '--heads', ORIGIN, branch_name).strip() != ''

# Opens a PR from the given branch to the target branch
def open_pr(
repo, all_commits, source_branch_short_sha, new_branch_name, source_branch, target_branch,
conductor, is_v2_release, labels, conflicted_files):
def open_pr(repo, all_commits, source_branch_short_sha, new_branch_name, conductor):
# Sort the commits into the pull requests that introduced them,
# and any commits that don't have a pull request
pull_requests = []
commits_without_pull_requests = []
for commit in all_commits:
pr = get_pr_for_commit(repo, commit)
pr = get_pr_for_commit(commit)

if pr is None:
commits_without_pull_requests.append(commit)
elif not any(p for p in pull_requests if p.number == pr.number):
pull_requests.append(pr)

print('Found ' + str(len(pull_requests)) + ' pull requests')
print('Found ' + str(len(commits_without_pull_requests)) + ' commits not in a pull request')
print(f'Found {len(pull_requests)} pull requests.')
print(f'Found {len(commits_without_pull_requests)} commits not in a pull request.')

# Sort PRs and commits by age
pull_requests = sorted(pull_requests, key=lambda pr: pr.number)
commits_without_pull_requests = sorted(commits_without_pull_requests, key=lambda c: c.commit.author.date)

# Start constructing the body text
body = []
body.append('Merging ' + source_branch_short_sha + ' into ' + target_branch)
body.append(f'Merging {source_branch_short_sha} into {TARGET_BRANCH}.')

body.append('')
body.append(f'Conductor for this PR is @{conductor}.')
Expand All @@ -87,50 +79,33 @@ def open_pr(

body.append('')
body.append('Please do the following:')
if len(conflicted_files) > 0:
body.append(' - [ ] Ensure `package.json` file contains the correct version.')
body.append(' - [ ] Add commits to this branch to resolve the merge conflicts ' +
'in the following files:')
body.extend([f' - [ ] `{file}`' for file in conflicted_files])
body.append(' - [ ] Ensure another maintainer has reviewed the additional commits you added to this ' +
'branch to resolve the merge conflicts.')
body.append(' - [ ] Ensure the CHANGELOG displays the correct version and date.')
body.append(' - [ ] Ensure the CHANGELOG includes all relevant, user-facing changes since the last release.')
body.append(' - [ ] Check that there are not any unexpected commits being merged into the ' + target_branch + ' branch.')
body.append(f' - [ ] Check that there are not any unexpected commits being merged into the {TARGET_BRANCH} branch.')
body.append(' - [ ] Ensure the docs team is aware of any documentation changes that need to be released.')

if not is_v2_release:
body.append(' - [ ] Remove and re-add the "Update dependencies" label to the PR to trigger just this workflow.')
body.append(' - [ ] Wait for the "Update dependencies" workflow to push a commit updating the dependencies.')
body.append(' - [ ] Mark the PR as ready for review to trigger the full set of PR checks.')

body.append(' - [ ] Approve and merge this PR. Make sure `Create a merge commit` is selected rather than `Squash and merge` or `Rebase and merge`.')
body.append(' - [ ] Merge the mergeback PR that will automatically be created once this PR is merged.')

if is_v2_release:
body.append(' - [ ] Merge the mergeback PR that will automatically be created once this PR is merged.')
body.append(' - [ ] Merge the v1 release PR that will automatically be created once this PR is merged.')

title = 'Merge ' + source_branch + ' into ' + target_branch
title = f'Merge {SOURCE_BRANCH} into {TARGET_BRANCH}'

# Create the pull request
# PR checks won't be triggered on PRs created by Actions. Therefore mark the PR as draft so that
# a maintainer can take the PR out of draft, thereby triggering the PR checks.
pr = repo.create_pull(title=title, body='\n'.join(body), head=new_branch_name, base=target_branch, draft=True)
pr.add_to_labels(*labels)
print('Created PR #' + str(pr.number))
pr = repo.create_pull(title=title, body='\n'.join(body), head=new_branch_name, base=TARGET_BRANCH, draft=True)
print(f'Created PR #{pr.number}')

# Assign the conductor
pr.add_to_assignees(conductor)
print('Assigned PR to ' + conductor)
print(f'Assigned PR to {conductor}')

# Gets a list of the SHAs of all commits that have happened on the source branch
# since the last release to the target branch.
# This will not include any commits that exist on the target branch
# that aren't on the source branch.
def get_commit_difference(repo, source_branch, target_branch):
def get_commit_difference(repo):
# Passing split nothing means that the empty string splits to nothing: compare `''.split() == []`
# to `''.split('\n') == ['']`.
commits = run_git('log', '--pretty=format:%H', ORIGIN + '/' + target_branch + '..' + ORIGIN + '/' + source_branch).strip().split()
commits = run_git('log', '--pretty=format:%H', f'{ORIGIN}/{TARGET_BRANCH}..{ORIGIN}/{SOURCE_BRANCH}').strip().split()

# Convert to full-fledged commit objects
commits = [repo.get_commit(c) for c in commits]
Expand All @@ -146,13 +121,13 @@ def is_pr_merge_commit(commit):
def get_truncated_commit_message(commit):
message = commit.commit.message.split('\n')[0]
if len(message) > 60:
return message[:57] + '...'
return f'{message[:57]}...'
else:
return message

# Converts a commit into the PR that introduced it to the source branch.
# Returns the PR object, or None if no PR could be found.
def get_pr_for_commit(repo, commit):
def get_pr_for_commit(commit):
prs = commit.get_pulls()

if prs.totalCount > 0:
Expand Down Expand Up @@ -186,7 +161,7 @@ def update_changelog(version):
else:
content = EMPTY_CHANGELOG

newContent = content.replace('[UNRELEASED]', version + ' - ' + get_today_string(), 1)
newContent = content.replace('[UNRELEASED]', f'{version} - {get_today_string()}', 1)

with open('CHANGELOG.md', 'w') as f:
f.write(newContent)
Expand All @@ -207,16 +182,6 @@ def main():
required=True,
help='The nwo of the repository, for example github/codeql-action.'
)
parser.add_argument(
'--mode',
type=str,
required=True,
choices=[V2_MODE, V1_MODE],
help=f"Which release to perform. '{V2_MODE}' uses {SOURCE_BRANCH_FOR_MODE[V2_MODE]} as the source " +
f"branch and {TARGET_BRANCH_FOR_MODE[V2_MODE]} as the target branch. " +
f"'{V1_MODE}' uses {SOURCE_BRANCH_FOR_MODE[V1_MODE]} as the source branch and " +
f"{TARGET_BRANCH_FOR_MODE[V1_MODE]} as the target branch."
)
parser.add_argument(
'--conductor',
type=str,
Expand All @@ -226,110 +191,46 @@ def main():

args = parser.parse_args()

source_branch = SOURCE_BRANCH_FOR_MODE[args.mode]
target_branch = TARGET_BRANCH_FOR_MODE[args.mode]

repo = Github(args.github_token).get_repo(args.repository_nwo)
version = get_current_version()

if args.mode == V1_MODE:
# Change the version number to a v1 equivalent
version = get_current_version()
version = f'1{version[1:]}'

# Print what we intend to go
print('Considering difference between ' + source_branch + ' and ' + target_branch)
source_branch_short_sha = run_git('rev-parse', '--short', ORIGIN + '/' + source_branch).strip()
print('Current head of ' + source_branch + ' is ' + source_branch_short_sha)
print(f'Considering difference between {SOURCE_BRANCH} and {TARGET_BRANCH}...')
source_branch_short_sha = run_git('rev-parse', '--short', f'{ORIGIN}/{SOURCE_BRANCH}').strip()
print(f'Current head of {SOURCE_BRANCH} is {source_branch_short_sha}.')

# See if there are any commits to merge in
commits = get_commit_difference(repo=repo, source_branch=source_branch, target_branch=target_branch)
commits = get_commit_difference(repo=repo)
if len(commits) == 0:
print('No commits to merge from ' + source_branch + ' to ' + target_branch)
print(f'No commits to merge from {SOURCE_BRANCH} to {TARGET_BRANCH}.')
return

# The branch name is based off of the name of branch being merged into
# and the SHA of the branch being merged from. Thus if the branch already
# exists we can assume we don't need to recreate it.
new_branch_name = 'update-v' + version + '-' + source_branch_short_sha
print('Branch name is ' + new_branch_name)
new_branch_name = f'update-v{version}-{source_branch_short_sha}'
print(f'Branch name is {new_branch_name}.')

# Check if the branch already exists. If so we can abort as this script
# has already run on this combination of branches.
if branch_exists_on_remote(new_branch_name):
print('Branch ' + new_branch_name + ' already exists. Nothing to do.')
print(f'Branch {new_branch_name} already exists. Nothing to do.')
return

# Create the new branch and push it to the remote
print('Creating branch ' + new_branch_name)

# The process of creating the v1 release can run into merge conflicts. We commit the unresolved
# conflicts so a maintainer can easily resolve them (vs erroring and requiring maintainers to
# reconstruct the release manually)
conflicted_files = []

if args.mode == V1_MODE:
# If we're performing a backport, start from the target branch
print(f'Creating {new_branch_name} from the {ORIGIN}/{target_branch} branch')
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{target_branch}')

# Revert the commit that we made as part of the last release that updated the version number and
# changelog to refer to 1.x.x variants. This avoids merge conflicts in the changelog and
# package.json files when we merge in the v2 branch.
# This commit will not exist the first time we release the v1 branch from the v2 branch, so we
# use `git log --grep` to conditionally revert the commit.
print('Reverting the 1.x.x version number and changelog updates from the last release to avoid conflicts')
v1_update_commits = run_git('log', '--grep', '^Update version and changelog for v', '--format=%H').split()

if len(v1_update_commits) > 0:
print(f' Reverting {v1_update_commits[0]}')
# Only revert the newest commit as older ones will already have been reverted in previous
# releases.
run_git('revert', v1_update_commits[0], '--no-edit')

# Also revert the "Update checked-in dependencies" commit created by Actions.
update_dependencies_commit = run_git('log', '--grep', '^Update checked-in dependencies', '--format=%H').split()[0]
print(f' Reverting {update_dependencies_commit}')
run_git('revert', update_dependencies_commit, '--no-edit')

else:
print(' Nothing to revert.')

print(f'Merging {ORIGIN}/{source_branch} into the release prep branch')
# Commit any conflicts (see the comment for `conflicted_files`)
run_git('merge', f'{ORIGIN}/{source_branch}', allow_non_zero_exit_code=True)
conflicted_files = run_git('diff', '--name-only', '--diff-filter', 'U').splitlines()
if len(conflicted_files) > 0:
run_git('add', '.')
run_git('commit', '--no-edit')

# Migrate the package version number from a v2 version number to a v1 version number
print(f'Setting version number to {version}')
subprocess.check_output(['npm', 'version', version, '--no-git-tag-version'])
run_git('add', 'package.json', 'package-lock.json')

# Migrate the changelog notes from v2 version numbers to v1 version numbers
print('Migrating changelog notes from v2 to v1')
subprocess.check_output(['sed', '-i', 's/^## 2\./## 1./g', 'CHANGELOG.md'])

# Remove changelog notes from v2 that don't apply to v1
subprocess.check_output(['sed', '-i', '/^- \[v2+ only\]/d', 'CHANGELOG.md'])

# Amend the commit generated by `npm version` to update the CHANGELOG
run_git('add', 'CHANGELOG.md')
run_git('commit', '-m', f'Update version and changelog for v{version}')
else:
# If we're performing a standard release, there won't be any new commits on the target branch,
# as these will have already been merged back into the source branch. Therefore we can just
# start from the source branch.
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{source_branch}')
print(f'Creating branch {new_branch_name}.')

# If we're performing a standard release, there won't be any new commits on the target branch,
# as these will have already been merged back into the source branch. Therefore we can just
# start from the source branch.
run_git('checkout', '-b', new_branch_name, f'{ORIGIN}/{SOURCE_BRANCH}')

print('Updating changelog')
update_changelog(version)
print('Updating changelog')
update_changelog(version)

# Create a commit that updates the CHANGELOG
run_git('add', 'CHANGELOG.md')
run_git('commit', '-m', f'Update changelog for v{version}')
# Create a commit that updates the CHANGELOG
run_git('add', 'CHANGELOG.md')
run_git('commit', '-m', f'Update changelog for v{version}')

run_git('push', ORIGIN, new_branch_name)

Expand All @@ -339,12 +240,7 @@ def main():
commits,
source_branch_short_sha,
new_branch_name,
source_branch=source_branch,
target_branch=target_branch,
conductor=args.conductor,
is_v2_release=args.mode == V2_MODE,
labels=['Update dependencies'] if args.mode == V1_MODE else [],
conflicted_files=conflicted_files
)

if __name__ == '__main__':
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/__analyze-ref-input.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .github/workflows/__autobuild-action.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .github/workflows/__export-file-baseline-information.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .github/workflows/__extractor-ram-threads.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.