Skip to content

Commit

Permalink
Update update_changelog.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles authored Aug 8, 2024
1 parent 2b86096 commit 14f7d6a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/update_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
if "${{ github.event.pull_request.user.login }}" == "dependabot[bot]":
changelog = " - **Description:** ${{ github.event.pull_request.title }}\n - **Products impact:** Dev Dependency upgrade\n - **Addresses:** -\n - **Components:** -\n - **Breaking:** -\n - **Impacts a11y:** -\n - **Guidance:** -"
else:
description = """${{ github.event.pull_request.body }}"""
capture = re.compile("<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG START -->\s+<!--(\n|.)+?(?=- \*\*Description)(?P<body>(\n|.)+?(?=<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG END -->))")
match = capture.search(description)
changelog = match.groupsdict()["body"].strip()
description = """${{ github.event.pull_request.body }}"""
capture = re.compile("<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG START -->\s+<!--(\n|.)+?(?=- \*\*Description)(?P<body>(\n|.)+?(?=<!-- \[DO NOT REMOVE-USED BY GH ACTION\] CHANGELOG END -->))")
match = capture.search(description)
changelog = match.groupsdict()["body"].strip()
final_changelog = "<!-- [DO NOT REMOVE-USED BY GH ACTION] PASTE CHANGELOG -->\n\n"
Expand All @@ -51,14 +51,13 @@ jobs:
if changeline.startwith("- **Guidance:**"):
final_changelog += "\n" + pr_link_ref + "\n"
with open("CHANGELOG.md", "r") as f:
current_changelog = f.read()
with open("CHANGELOG.md", "r") as f:
current_changelog = f.read()
new_changelog = current_changelog.replace("<!-- [DO NOT REMOVE-USED BY GH ACTION] PASTE CHANGELOG -->", final_changelog)
with open("CHANGELOG.md", "w") as f:
f.write(new_changelog)
new_changelog = current_changelog.replace("<!-- [DO NOT REMOVE-USED BY GH ACTION] PASTE CHANGELOG -->", final_changelog)
with open("CHANGELOG.md", "w") as f:
f.write(new_changelog)
- uses: tibdex/github-app-token@v1
id: generate-token
with:
Expand Down

0 comments on commit 14f7d6a

Please sign in to comment.