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

Adds additional changelog skip (NPFC) & skip checks for nanomap-render #1595

Closed
wants to merge 4 commits into from
Closed
Changes from 2 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
19 changes: 15 additions & 4 deletions tools/changelog/check_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DO NOT MANUALLY RUN THIS SCRIPT.
---------------------------------

Expected envrionmental variables:
Expected environmental variables:
-----------------------------------
GITHUB_REPOSITORY: Github action variable representing the active repo (Action provided)
BOT_TOKEN: A repository account token, this will allow the action to push the changes (Action provided)
Expand Down Expand Up @@ -37,6 +37,14 @@


def build_changelog(pr: dict) -> dict:
# Check for the presence of :cl: or 🆑 tags in the PR body
dj-34 marked this conversation as resolved.
Show resolved Hide resolved
if not (":cl:" in pr.body or "🆑" in pr.body):
# Check if "NPFC" is in the PR body
if "NPFC" in pr.body:
pr.add_to_labels(CL_NOT_NEEDED)
print("Changelog tags (:cl: or 🆑) are missing, but 'NPFC' is present. Skipping changelog validation.")
return None # Return None to truly skip changelog generation

changelog = parse_changelog(pr.body)
changelog["author"] = changelog["author"] or pr.user.login
return changelog
Expand Down Expand Up @@ -146,7 +154,7 @@ def parse_changelog(message: str) -> dict:
cl_required = False

if not cl_required:
# remove invalid, remove valid
# Remove invalid, remove valid
if has_invalid_label:
pr.remove_from_labels(CL_INVALID)
if has_valid_label:
Expand All @@ -155,21 +163,24 @@ def parse_changelog(message: str) -> dict:

try:
cl = build_changelog(pr)
if cl is None:
exit(0)
dj-34 marked this conversation as resolved.
Show resolved Hide resolved

cl_emoji = emojify_changelog(cl)
cl_emoji["author"] = cl_emoji["author"] or pr_author
validate_changelog(cl_emoji)
except Exception as e:
print("Changelog parsing error:")
print(e)

# add invalid, remove valid
# Add invalid, remove valid
if not has_invalid_label:
pr.add_to_labels(CL_INVALID)
if has_valid_label:
pr.remove_from_labels(CL_VALID)
exit(1)

# remove invalid, add valid
# Remove invalid, add valid
if has_invalid_label:
pr.remove_from_labels(CL_INVALID)
if not has_valid_label:
Expand Down
Loading