Skip to content

fix: sync Cargo.lock on release PRs via release workflow #1

fix: sync Cargo.lock on release PRs via release workflow

fix: sync Cargo.lock on release PRs via release workflow #1

name: Sync Cargo.lock on Release PR
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
permissions:
contents: write
jobs:
sync-cargo-lock:
name: Sync Cargo.lock to match Cargo.toml version
runs-on: ubuntu-latest
# Only run for release-please PRs
if: startsWith(github.head_ref, 'release-please--')
steps:
- name: Checkout PR branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.head_ref }}
- name: Install stable Rust toolchain
run: rustup toolchain install stable --no-self-update
- name: Update Cargo.lock for thuki package
working-directory: src-tauri
run: cargo update --package thuki
- name: Commit Cargo.lock if it changed
run: |
if ! git diff --quiet src-tauri/Cargo.lock; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add src-tauri/Cargo.lock
git commit -m "chore: sync Cargo.lock to version bump"
git push
else
echo "Cargo.lock already in sync, nothing to commit"
fi