Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Cargo Release

on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'

jobs:
release:
Expand All @@ -11,16 +13,28 @@ jobs:
contents: write
id-token: write
steps:
- uses: actions/checkout@v5
- run: |
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- uses: actions/checkout@v4
with:
ref: main

Comment on lines +17 to 19
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow is triggered by pushing a tag, but it checks out main and then publishes from whatever is currently on main. That can publish code that does not correspond to the tagged commit (e.g., if the tag was created from an older commit or main advanced), which breaks the expectation that a tag identifies the exact source being released. Consider checking out the tag ref/sha that triggered the workflow for the publish step, and avoid mutating main as part of the tag-triggered release (or at least fail the job if the tag commit is not main HEAD).

Suggested change
with:
ref: main
- name: Ensure tag matches main HEAD
run: |
git fetch origin main
TAG_SHA="$(git rev-parse HEAD)"
MAIN_SHA="$(git rev-parse origin/main)"
if [ "$TAG_SHA" != "$MAIN_SHA" ]; then
echo "Tag commit ($TAG_SHA) does not match origin/main HEAD ($MAIN_SHA). Aborting release."
exit 1
fi

Copilot uses AI. Check for mistakes.
- name: Install cargo release
run: cargo install cargo-release
- name: Extract version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"

- name: Update Cargo.toml version
run: sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml

- name: Commit version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Cargo.toml
git commit -m "chore: bump version to $VERSION"
git push origin main

- uses: rust-lang/crates-io-auth-action@v1
id: auth
- run: cargo release patch --execute --no-confirm

- name: Publish to crates.io
run: cargo publish
Comment on lines +37 to +38
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release job runs cargo publish without explicitly installing/pinning a Rust toolchain (it relies on whatever happens to be preinstalled on ubuntu-latest). This can lead to non-reproducible releases or unexpected breakage when the runner image changes. Add an explicit Rust toolchain setup step (or a checked-in toolchain file) so the publish environment is deterministic.

Copilot uses AI. Check for mistakes.
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
4 changes: 3 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v4

Comment on lines 17 to 19
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steps: list items appear to be indented at the same level as steps: itself, which makes the workflow YAML invalid (GitHub Actions expects the - uses / - name entries to be nested under steps). Indent all step entries (including this checkout step) two spaces further than steps: so the workflow can parse and run.

Copilot uses AI. Check for mistakes.
- name: Cache
uses: actions/cache@v4
Expand All @@ -25,6 +25,8 @@ jobs:
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Build
run: cargo build --verbose
Expand Down
1 change: 1 addition & 0 deletions examples/tetris/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl FieldExt for Field {
false
}

#[allow(clippy::needless_range_loop)]
fn is_gameover(&self) -> bool {
for x in 0..FIELD_WIDTH {
if self[FIELD_MARGIN][x].is_some() {
Expand Down