Skip to content

Commit 32d41f3

Browse files
authored
Merge pull request #3403 from github/henrymercer/abridge-release-notes
Abridge release notes
2 parents d60bbdf + ec4eda1 commit 32d41f3

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

.github/workflows/post-release-mergeback.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,8 @@ jobs:
123123
- name: Prepare partial Changelog
124124
env:
125125
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
126-
VERSION: "${{ steps.getVersion.outputs.version }}"
127126
run: |
128-
python .github/workflows/script/prepare_changelog.py CHANGELOG.md "$VERSION" > $PARTIAL_CHANGELOG
127+
python .github/workflows/script/prepare_changelog.py CHANGELOG.md > $PARTIAL_CHANGELOG
129128
130129
echo "::group::Partial CHANGELOG"
131130
cat $PARTIAL_CHANGELOG

.github/workflows/rollback-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ jobs:
127127
env:
128128
NEW_CHANGELOG: "${{ runner.temp }}/new_changelog.md"
129129
PARTIAL_CHANGELOG: "${{ runner.temp }}/partial_changelog.md"
130-
VERSION: "${{ needs.prepare.outputs.version }}"
131130
run: |
132-
python .github/workflows/script/prepare_changelog.py $NEW_CHANGELOG "$VERSION" > $PARTIAL_CHANGELOG
131+
python .github/workflows/script/prepare_changelog.py $NEW_CHANGELOG > $PARTIAL_CHANGELOG
133132
134133
echo "::group::Partial CHANGELOG"
135134
cat $PARTIAL_CHANGELOG

.github/workflows/script/bundle_changelog.py

100644100755
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
#!/usr/bin/env python3
12
import os
23
import re
34

5+
cli_version = os.environ['CLI_VERSION']
6+
7+
# The GitHub Release for the new bundle version.
8+
bundle_release_url = f"https://github.com/github/codeql-action/releases/tag/codeql-bundle-v{cli_version}"
49
# Get the PR number from the PR URL.
510
pr_number = os.environ['PR_URL'].split('/')[-1]
6-
changelog_note = f"- Update default CodeQL bundle version to {os.environ['CLI_VERSION']}. [#{pr_number}]({os.environ['PR_URL']})"
11+
changelog_note = f"- Update default CodeQL bundle version to [{cli_version}]({bundle_release_url}). [#{pr_number}]({os.environ['PR_URL']})"
712

813
# If the "[UNRELEASED]" section starts with "no user facing changes", remove that line.
914
with open('CHANGELOG.md', 'r') as f:

.github/workflows/script/prepare_changelog.py

100644100755
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env python3
12
import os
23
import sys
34

@@ -6,7 +7,7 @@
67
# Prepare the changelog for the new release
78
# This function will extract the part of the changelog that
89
# we want to include in the new release.
9-
def extract_changelog_snippet(changelog_file, version_tag):
10+
def extract_changelog_snippet(changelog_file):
1011
output = ''
1112
if (not os.path.exists(changelog_file)):
1213
output = EMPTY_CHANGELOG
@@ -15,23 +16,20 @@ def extract_changelog_snippet(changelog_file, version_tag):
1516
with open(changelog_file, 'r') as f:
1617
lines = f.readlines()
1718

18-
# Include everything up to, but excluding the second heading
19+
# Include only the contents of the first section
1920
found_first_section = False
20-
for i, line in enumerate(lines):
21+
for line in lines:
2122
if line.startswith('## '):
2223
if found_first_section:
2324
break
2425
found_first_section = True
25-
output += line
26+
elif found_first_section:
27+
output += line
2628

27-
output += f"See the full [CHANGELOG.md](https://github.com/github/codeql-action/blob/{version_tag}/CHANGELOG.md) for more information."
29+
return output.strip()
2830

29-
return output
3031

31-
32-
if len(sys.argv) < 3:
33-
raise Exception('Expecting argument: changelog_file version_tag')
32+
if len(sys.argv) < 2:
33+
raise Exception('Expecting argument: changelog_file')
3434
changelog_file = sys.argv[1]
35-
version_tag = sys.argv[2]
36-
37-
print(extract_changelog_snippet(changelog_file, version_tag))
35+
print(extract_changelog_snippet(changelog_file))

0 commit comments

Comments
 (0)