Skip to content
Merged
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: 17 additions & 13 deletions .github/workflows/recreate-lockfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Recreate Cargo lockfile

on:
schedule:
- cron: "0 0 * * *" # At the end of every day
- cron: "0 0 1,15 * *" # Run every 1st and 15th of the month at 00:00 UTC
workflow_dispatch:
inputs:
branch:
Expand All @@ -26,7 +26,7 @@ jobs:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
steps:
- name: Checkout Zenoh
uses: actions/checkout@v4
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: eclipse-zenoh/zenoh
ref: ${{ inputs.branch }}
Expand All @@ -44,16 +44,20 @@ jobs:
run: |
set -euo pipefail

if [[ -n "$TOOLCHAIN_INPUT" ]]; then
RUST_TOOLCHAIN="$TOOLCHAIN_INPUT"
else
RUST_TOOLCHAIN="$(yq -r '.toolchain.channel // ""' rust-toolchain.toml)"
fi
# NOTE: override to nightly toolchain so we can use cargo's -Zmin-publish-age
# to avoid pulling in recently published dependencies possibly mitigating supply chain attacks.
# This feature will be available in 1.100.0 scheduled for release in September 2026.
RUST_TOOLCHAIN="nightly"
#if [[ -n "$TOOLCHAIN_INPUT" ]]; then
# RUST_TOOLCHAIN="$TOOLCHAIN_INPUT"
#else
# RUST_TOOLCHAIN="$(yq -r '.toolchain.channel // ""' rust-toolchain.toml)"
#fi

if [[ ! "$RUST_TOOLCHAIN" =~ ^[A-Za-z0-9][A-Za-z0-9._+@-]*$ ]]; then
echo "Invalid Rust toolchain" >&2
exit 1
fi
#if [[ ! "$RUST_TOOLCHAIN" =~ ^[A-Za-z0-9][A-Za-z0-9._+@-]*$ ]]; then
# echo "Invalid Rust toolchain" >&2
# exit 1
#fi

printf 'RUST_TOOLCHAIN=%s\n' "$RUST_TOOLCHAIN" >> "$GITHUB_ENV"

Expand All @@ -70,12 +74,12 @@ jobs:
- name: Recreate Cargo.lock
run: |
rm -f Cargo.lock
cargo "+${RUST_TOOLCHAIN}" update --manifest-path Cargo.toml
cargo "+${RUST_TOOLCHAIN}" -Zmin-publish-age --config registry.global-min-publish-age='"7 days"' update --manifest-path Cargo.toml

- name: Create/Update a pull request if the lockfile changed
id: cpr
# NOTE: If there is a pending PR, this action will simply update it with a forced push.
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
title: "chore: recreate Cargo.lock"
body: |
Expand Down
Loading