From aa1f810feb6c96cff5df870a5edd4f17a9180149 Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Thu, 17 Oct 2024 15:10:40 +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 0dd0b2cd32a108e6f0b9aee3be0fcbc10c28fb7b Mon Sep 17 00:00:00 2001 From: Denis Varlakov Date: Thu, 17 Oct 2024 15:28:18 +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 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