From 8077f4b6676c3e2a031d0e6c03eb9e30df7ebddb Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Thu, 27 Feb 2025 21:39:42 -0500 Subject: [PATCH 1/4] add check for git changes --- .github/workflows/build-release.yml | 9 ++++++++- .github/workflows/rust.yml | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index bb2208f..8410ae3 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -1,5 +1,5 @@ -name: build-release +name: build-release on: push: branches: [ "main" ] @@ -34,6 +34,13 @@ jobs: - uses: actions/checkout@v4 - name: build run: cargo build --release + - name: check for any changes in the git tree + run: | + if [[ -n "$(git status --porcelain)" ]]; then + echo '::error title=post-build check::changes detected in git tree' + git status + exit 1 + fi - name: Attest Build Provenance uses: actions/attest-build-provenance@v1 with: diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9dc6bb..8c776dd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,6 +16,13 @@ jobs: - uses: actions/checkout@v4 - name: cargo build run: scripts/cargo_to_gh rustc --message-format json -- -Awarnings + - name: check for any changes in the git tree + run: | + if [[ -n "$(git status --porcelain)" ]]; then + echo '::error title=post-build check::changes detected in git tree' + git status + exit 1 + fi check: runs-on: ubuntu-latest From 3365e0d0723d12607f2eb927321dfb8c83cf6a7a Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Thu, 27 Feb 2025 22:47:49 -0500 Subject: [PATCH 2/4] bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 38e5d54..e237cef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdq" -version = "0.3.0" +version = "0.3.1" edition = "2021" license = "MIT OR Apache-2.0" description = "Select specific elements in a Markdown document" From d9a7709b1e0554528213ede7382d960e5d577803 Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Thu, 27 Feb 2025 22:38:29 -0500 Subject: [PATCH 3/4] improve error message --- .github/workflows/rust.yml | 15 +++++++++------ Cargo.lock | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8c776dd..3c7e169 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -18,12 +18,15 @@ jobs: run: scripts/cargo_to_gh rustc --message-format json -- -Awarnings - name: check for any changes in the git tree run: | - if [[ -n "$(git status --porcelain)" ]]; then - echo '::error title=post-build check::changes detected in git tree' - git status - exit 1 - fi - + exit_code=0 + while read -r status_code file_path; do + if [[ -z "$status_code" ]]; then + continue + fi + exit_code=1 + echo "::error file=$file_path,title=git-status::<$status_code> $file_path" + done <<<"$(git status --porcelain)" + exit "$exit_code" check: runs-on: ubuntu-latest needs: build diff --git a/Cargo.lock b/Cargo.lock index 3993dd7..59b4ca0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,7 +176,7 @@ dependencies = [ [[package]] name = "mdq" -version = "0.1.0" +version = "0.3.0" dependencies = [ "clap", "indoc", From 9589bd4b181972e358e52a464d647b4a7967cb33 Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Thu, 27 Feb 2025 23:05:27 -0500 Subject: [PATCH 4/4] cargo build --- Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 59b4ca0..a8a7f5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,7 +176,7 @@ dependencies = [ [[package]] name = "mdq" -version = "0.3.0" +version = "0.3.1" dependencies = [ "clap", "indoc",