Skip to content

Commit

Permalink
ci: only lint for changes in src/ & Cargo.toml
Browse files Browse the repository at this point in the history
Sometimes, we need to adjust the tests of crates together with a feature change or fix in other crates. Changes to tests don't need to go into the changelog. Hence, we change the changelog-lint to only look at the diff in the `src/` directory and the `Cargo.toml` file.

Pull-Request: #4748.
  • Loading branch information
thomaseizinger authored Oct 30, 2023
1 parent 9bd127f commit 3ea0f75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/ensure-version-bump-and-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DIR_TO_CRATE=$(dirname "$MANIFEST_PATH")

MERGE_BASE=$(git merge-base "$HEAD_SHA" master) # Find the merge base. This ensures we only diff what was actually added in the PR.

DIFF_TO_MASTER=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-status -- "$DIR_TO_CRATE")
SRC_DIFF_TO_MASTER=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-status -- "$DIR_TO_CRATE/src" "$DIR_TO_CRATE/Cargo.toml")
CHANGELOG_DIFF=$(git diff "$HEAD_SHA".."$MERGE_BASE" --name-only -- "$DIR_TO_CRATE/CHANGELOG.md")

VERSION_IN_CHANGELOG=$(awk -F' ' '/^## [0-9]+\.[0-9]+\.[0-9]+/{print $2; exit}' "$DIR_TO_CRATE/CHANGELOG.md")
Expand All @@ -19,8 +19,8 @@ if [[ "$VERSION_IN_CHANGELOG" != "$VERSION_IN_MANIFEST" ]]; then
exit 1
fi

# If the crate wasn't touched in this PR, exit early.
if [ -z "$DIFF_TO_MASTER" ]; then
# If the source files of this crate weren't touched in this PR, exit early.
if [ -z "$SRC_DIFF_TO_MASTER" ]; then
exit 0;
fi

Expand Down

0 comments on commit 3ea0f75

Please sign in to comment.