Skip to content

Commit

Permalink
Fix changelog script to not fail on main branch
Browse files Browse the repository at this point in the history
Signed-off-by: bbrzyski <[email protected]>
  • Loading branch information
bbrzyski authored and rw1nkler committed Dec 3, 2024
1 parent 13a3e35 commit 54d3ff8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import json
import logging
import os
import shutil
import sys
Expand Down Expand Up @@ -296,17 +297,24 @@ def package_cores(session: nox.Session) -> None:
@nox.session
def changed_changelog(session: nox.Session) -> None:
changelog_file_name = "CHANGELOG.md"
main_branch = "main"
current_branch = session.run("git", "branch", "--show-current", external=True, silent=True)
assert current_branch is not None
# Check if the script is run on the main branch
if current_branch.strip("\n") == main_branch:
return
changelog_changed = session.run(
"git",
"diff",
"--name-only",
"origin/main",
"origin/" + main_branch,
"--",
changelog_file_name,
external=True,
silent=True,
)
if not changelog_changed:
logging.error("Changelog was not updated!")
raise CommandFailed()


Expand Down

0 comments on commit 54d3ff8

Please sign in to comment.