Skip to content

Commit 54d3ff8

Browse files
bbrzyskirw1nkler
authored andcommitted
Fix changelog script to not fail on main branch
Signed-off-by: bbrzyski <bbrzyski@internships.antmicro.com>
1 parent 13a3e35 commit 54d3ff8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

noxfile.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import json
5+
import logging
56
import os
67
import shutil
78
import sys
@@ -296,17 +297,24 @@ def package_cores(session: nox.Session) -> None:
296297
@nox.session
297298
def changed_changelog(session: nox.Session) -> None:
298299
changelog_file_name = "CHANGELOG.md"
300+
main_branch = "main"
301+
current_branch = session.run("git", "branch", "--show-current", external=True, silent=True)
302+
assert current_branch is not None
303+
# Check if the script is run on the main branch
304+
if current_branch.strip("\n") == main_branch:
305+
return
299306
changelog_changed = session.run(
300307
"git",
301308
"diff",
302309
"--name-only",
303-
"origin/main",
310+
"origin/" + main_branch,
304311
"--",
305312
changelog_file_name,
306313
external=True,
307314
silent=True,
308315
)
309316
if not changelog_changed:
317+
logging.error("Changelog was not updated!")
310318
raise CommandFailed()
311319

312320

0 commit comments

Comments
 (0)