Skip to content

Commit

Permalink
check even in detached state
Browse files Browse the repository at this point in the history
  • Loading branch information
hejamu committed Apr 3, 2024
1 parent a656518 commit 3e0638a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions devtools/check_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class ChangelogError(Exception):

repo = git.Repo(folder)

if repo.active_branch.name == "main":
# Check if the developer is on the main branch
# We check if the head commit is the same as the main branch head commit
# as the CI will be in detached head state
if repo.head.commit == repo.branches["main"].commit:
print("You are on the main branch. Nothing to check.")
exit(0)

Expand All @@ -32,8 +35,8 @@ class ChangelogError(Exception):
if line.startswith("v"):
raise ChangelogError(
"You have not updated the CHANGELOG file. "
f"Please add a summary of your additions to {str(changelog)!r} "
f"as described in {str(contributing)!r}."
f"Please add a summary of your additions to {str(changelog)!r}"
f" as described in {str(contributing)!r}."
)
elif line.startswith("*"):
print("Changelog updated.")
Expand Down

0 comments on commit 3e0638a

Please sign in to comment.