Skip to content
Open
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
30 changes: 30 additions & 0 deletions templates/github/.ci/scripts/clean_gh_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

# This script is running with elevated privileges from the main branch against pull requests.

# This script cleans the input from artifacts which are used by the pulp documentation internally, but clutter for GitHub releases
import re
import sys

RE_VERSION = re.compile(r"^## (\d+\.\d+\.\d+)")

def main():
# Print disclaimer:
version_str = ""
for line in sys.stdin:
if line.endswith("\n"):
line = line[:-1]
if line.startswith("#"):
print(line.split(" {: #")[0])
match = RE_VERSION.match(line)
if match and version_str == "":
version_str = match.group(1)
print("")
print("> [!NOTE]")
print(f"> Changes are also available on [Pulp docs](https://pulpproject.org/pulpcore/changes/#{version_str})")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs against all Pulp plugins, so you can't hardcode pulpcore here.
You can either make this script a template (.j2) and use {{ plugin_name }} or pass as an argument trough publish.yml.j2, which is already a template.

else:
print(line)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion templates/github/.github/workflows/publish.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
run: |
# The last commit before the release commit contains the release CHANGES fragments
git checkout "${TAG_NAME}~"
NOTES=$(towncrier build --draft --version $TAG_NAME)
NOTES=$(towncrier build --draft --version $TAG_NAME | .ci/scripts/clean_gh_release_notes.py)
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand Down
Loading