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
33 changes: 33 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,33 @@
#!/usr/bin/env python3
# This script is running with elevated privileges from the main branch against pull requests.
#
# It cleans the input from artifacts which are used by the pulp documentation internally,
# but clutter for GitHub releases

import sys

NOTE = """
> [!NOTE]
> Official changes are available on [Pulp docs]({docs_url})\
"""


def main():
plugin_name = sys.argv[1]
version_str = sys.argv[2]
docs_url = f"https://pulpproject.org/{plugin_name}/changes/#{version_str}"
note_added = False
for line in sys.stdin:
if line.endswith("\n"):
line = line[:-1]
if line.startswith("#"):
print(line.split(" {: #")[0])
if not note_added and version_str in line:
print(NOTE.format(docs_url=docs_url))
note_added = True
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 {{ plugin_name }} $TAG_NAME)
echo "body<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand Down