Skip to content

Update semversioner check to use git#50

Open
darthtrevino wants to merge 2 commits intoraulgomis:masterfrom
darthtrevino:fix/check_command
Open

Update semversioner check to use git#50
darthtrevino wants to merge 2 commits intoraulgomis:masterfrom
darthtrevino:fix/check_command

Conversation

@darthtrevino
Copy link
Contributor

This PR updates the check command to interact with git to ensure that there is a change-document for the current branch if any impacted files are touched.

Fixes #48

@darthtrevino darthtrevino changed the title isolate check command updates Update semversioner check to use git May 6, 2024
@raulgomis
Copy link
Owner

Hi @darthtrevino , thanks for this idea and code contribution.

For now, I wouldn't like to couple this tool with any version control system in order to keep things simple and tool agnostic. I guess you could run the git diff external to the tool, can't you?

Cheers,
Raul

@darthtrevino
Copy link
Contributor Author

Sure, I can do that, but the check command is kind of pointless when it's not tied to a VCS. Here's a script I'm using in another project. One of my hopes here is that this tool can evolve to a state where it handles boilerplate like this.

#!/bin/sh
changes=$(git diff --name-only origin/main)
has_change_doc=$(echo $changes | grep .semversioner/next-release)
has_impacting_changes=$(echo $changes | grep my-project)

if [ "$has_impacting_changes" ] && [ -z "$has_change_doc" ]; then
    echo "Check failed. Run 'poetry run semversioner add-change' to update the next release version"
    exit 1
fi
echo "OK"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

semversioner check should assert that the current branch contains a change document

2 participants