diff --git a/.github/changelog.sh b/.github/changelog.sh new file mode 100755 index 0000000..fa3c35a --- /dev/null +++ b/.github/changelog.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +m_branch=m; +changelog_file=CHANGELOG.md; + +# fetch master since we might be in a shallow clone +git fetch origin "$m_branch:$m_branch" --depth=1 + +changed=0; +for log in "$changelog_file" */"$changelog_file"; do + dir=$(dirname "$log"); + # check if version changed + if git diff "$m_branch" -- "$dir/Cargo.toml" | grep -q "^-version = "; then + # check if changelog updated + if git diff --exit-code --no-patch "$m_branch" -- "$log"; then + echo "$dir version changed, but $log is not updated" + changed=1; + fi + fi +done + +exit "$changed"; diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f0d11f3..f7a61d7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -37,3 +37,9 @@ jobs: run: cargo clippy --all --lib -- -D clippy::all -D clippy::unwrap_used -D clippy::expect_used - name: Run clippy tests run: cargo clippy --tests -- -D clippy::all + check-changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check changelogs + run: ./.github/changelog.sh