From 3083b7ed27986e0cf77a37bfdd4a48ad2269f0cf Mon Sep 17 00:00:00 2001 From: user Date: Thu, 16 Oct 2025 10:53:41 -0400 Subject: [PATCH 1/4] Create nightly ci to prevent nightly CI failures in contrib PRs --- .../workflows/cron-weekly-update-nightly.yml | 43 +++++++++++++++++++ rust-toolchain.toml | 4 +- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/cron-weekly-update-nightly.yml diff --git a/.github/workflows/cron-weekly-update-nightly.yml b/.github/workflows/cron-weekly-update-nightly.yml new file mode 100644 index 000000000..19f54e0da --- /dev/null +++ b/.github/workflows/cron-weekly-update-nightly.yml @@ -0,0 +1,43 @@ +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 + steps: + - uses: actions/checkout@v5 + - 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 + committer: Update Nightly Rustc Bot + 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 + delete-branch: true diff --git a/rust-toolchain.toml b/rust-toolchain.toml index f6c717f55..d0eb01c0d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly" -components = ["rust-analyzer", "rust-src"] +channel = "nightly-2025-10-09" +components = ["rust-analyzer", "rust-src", "rustfmt", "clippy"] From 6ef96089d392b4e462852f0b415138a8c84b23ab Mon Sep 17 00:00:00 2001 From: user Date: Wed, 17 Dec 2025 15:55:46 -0500 Subject: [PATCH 2/4] persist credentials --- .github/workflows/cron-weekly-update-nightly.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cron-weekly-update-nightly.yml b/.github/workflows/cron-weekly-update-nightly.yml index 19f54e0da..30a051faf 100644 --- a/.github/workflows/cron-weekly-update-nightly.yml +++ b/.github/workflows/cron-weekly-update-nightly.yml @@ -10,6 +10,8 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 + with: + persist-credentials: false - uses: dtolnay/rust-toolchain@nightly - name: Update rust.yml to use latest nightly run: | From aa2ee71f5179aa950eb02ba1080fbb3f96b5d0db Mon Sep 17 00:00:00 2001 From: user Date: Wed, 17 Dec 2025 16:36:15 -0500 Subject: [PATCH 3/4] adjust permissions --- .github/workflows/cron-weekly-update-nightly.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/cron-weekly-update-nightly.yml b/.github/workflows/cron-weekly-update-nightly.yml index 30a051faf..fa67ac007 100644 --- a/.github/workflows/cron-weekly-update-nightly.yml +++ b/.github/workflows/cron-weekly-update-nightly.yml @@ -8,6 +8,10 @@ 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: From 138b4e1a3f26f75f2fbc27ee17198d301fe65965 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 17 Dec 2025 16:44:36 -0500 Subject: [PATCH 4/4] persist cred true --- .github/workflows/cron-weekly-update-nightly.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cron-weekly-update-nightly.yml b/.github/workflows/cron-weekly-update-nightly.yml index fa67ac007..99b850564 100644 --- a/.github/workflows/cron-weekly-update-nightly.yml +++ b/.github/workflows/cron-weekly-update-nightly.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - persist-credentials: false + persist-credentials: true - uses: dtolnay/rust-toolchain@nightly - name: Update rust.yml to use latest nightly run: | @@ -46,4 +46,3 @@ jobs: 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 - delete-branch: true