From 47cd8bffc0aba368e20fc3d1e33a1e9172d8c3fc Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Thu, 17 Oct 2024 15:09:32 +0200 Subject: [PATCH 1/2] Update changelog script Signed-off-by: Denis Varlakov --- .github/changelog.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .github/changelog.sh 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"; From 8780b00616260fd6692d8a8ddd482712d99c3e80 Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Thu, 17 Oct 2024 15:27:41 +0200 Subject: [PATCH 2/2] Add changelog check into workflow Signed-off-by: Denis Varlakov --- .github/workflows/rust.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5552ac7..68d7bbd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -82,3 +82,9 @@ jobs: cache-on-failure: "true" - name: Check docs run: RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo +nightly doc --workspace --all-features --no-deps + check-changelog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check changelogs + run: ./.github/changelog.sh