Skip to content
Closed
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
48 changes: 48 additions & 0 deletions .github/workflows/cron-weekly-update-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Nightly rustc
on:
push:
schedule:
- cron: "5 0 * * 6" # Saturday at 00:05
workflow_dispatch: # allows manual triggering
jobs:
format:
name: Update nightly rustc
runs-on: ubuntu-24.04
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v5
with:
persist-credentials: true
- uses: dtolnay/rust-toolchain@nightly
- name: Update rust.yml to use latest nightly
run: |
set -x
# Not every night has a nightly, so extract the date from whatever
# version of the compiler dtolnay/rust-toolchain gives us.
NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p')
# Update the nightly version in the reference file.
echo -e "[toolchain]\nchannel = \"nightly-${NIGHTLY_DATE}\"\ncomponents = [\"rust-analyzer\", \"rust-src\", \"rustfmt\", \"clippy\"]" > rust-toolchain.toml
echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV
# Some days there is no new nightly. In this case don't make an empty PR.
if ! git diff --exit-code > /dev/null; then
echo "Updated nightly. Opening PR."
echo "changes_made=true" >> $GITHUB_ENV
else
echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR."
echo "changes_made=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
if: env.changes_made == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.BENALLENG_CREATE_PR_TOKEN }}
author: Update Nightly Rustc Bot <bot@example.com>
committer: Update Nightly Rustc Bot <bot@example.com>
title: Automated daily update to rustc (to nightly-${{ env.nightly_date }})
body: |
Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }}
branch: create-pull-request/weekly-nightly-ci-check
4 changes: 2 additions & 2 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly"
components = ["rust-analyzer", "rust-src"]
channel = "nightly-2025-10-09"
components = ["rust-analyzer", "rust-src", "rustfmt", "clippy"]
Loading