@@ -116,10 +116,46 @@ jobs:
116116 command : check
117117 command-arguments : ${{ matrix.checks }} -c .config/deny.toml
118118
119+ semver-checks :
120+ name : Semver checks
121+ runs-on : ubuntu-latest
122+ if : |
123+ startsWith(github.head_ref, 'release-please--') &&
124+ !github.event.pull_request.draft
125+ steps :
126+ - uses : actions/checkout@v4
127+ - uses : actions-rust-lang/setup-rust-toolchain@v1
128+ with :
129+ cache : true
130+ - name : Install cargo-binstall
131+ uses : cargo-bins/cargo-binstall@main
132+ - name : Install cargo-semver-checks
133+ run : cargo binstall cargo-semver-checks --no-confirm
134+ - name : Run semver checks for published crates
135+ run : |
136+ crate_names=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')
137+ published_pkgs=()
138+ for crate in $crate_names; do
139+ status=$(curl -s -o /dev/null -w "%{http_code}" \
140+ -H "User-Agent: github-actions-semver-check" \
141+ "https://crates.io/api/v1/crates/$crate")
142+ if [ "$status" = "200" ]; then
143+ echo "✓ '$crate' is published — will run semver-checks"
144+ published_pkgs+=("--package" "$crate")
145+ else
146+ echo "✗ '$crate' is not yet published (HTTP $status) — skipping"
147+ fi
148+ done
149+ if [ "${#published_pkgs[@]}" -gt 0 ]; then
150+ cargo semver-checks "${published_pkgs[@]}"
151+ else
152+ echo "No crates are published yet — skipping semver checks entirely."
153+ fi
154+
119155 lint :
120156 name : Lint
121157 if : ${{ always() && !github.event.pull_request.draft }}
122- needs : [pre-commit, validate-pr-title, cargo-deny]
158+ needs : [pre-commit, validate-pr-title, cargo-deny, semver-checks ]
123159 runs-on : ubuntu-latest
124160 steps :
125161 - run : |
0 commit comments