diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eff759f..349f69d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,10 @@ name: Build and Lint on: [push] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + # Make sure CI fails on all warnings, including Clippy lints env: RUSTFLAGS: "-D warnings" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fc84ded..1548123 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,10 @@ on: tags: - '*.*.*' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 @@ -18,6 +22,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Rustfmt + run: cargo fmt -- --check - name: Clippy run: cargo clippy --all-targets --all-features - name: Build diff --git a/src/changelog.rs b/src/changelog.rs index 57f37c5..20844f8 100644 --- a/src/changelog.rs +++ b/src/changelog.rs @@ -136,7 +136,11 @@ impl Changelog { } pub fn save_to_file(&self, path: &str) -> Result<()> { - let mut file = OpenOptions::new().write(true).create(true).open(path)?; + let mut file = OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .open(path)?; file.write_all(self.to_string().as_bytes())?; file.flush()?; Ok(())