2024-02-20 14:55:59 +00:00
|
|
|
name: Update Nightly rustc
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "0 0 * * *" # runs daily at 00:00
|
|
|
|
workflow_dispatch: # allows manual triggering
|
|
|
|
jobs:
|
|
|
|
format:
|
|
|
|
name: Update nightly rustc
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- 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 "nightly-${NIGHTLY_DATE}" > .github/nightly-version
|
|
|
|
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@v6
|
|
|
|
with:
|
2024-03-07 14:46:16 +00:00
|
|
|
token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }}
|
2024-02-20 14:55:59 +00:00
|
|
|
author: Update Nightly Rustc Bot <bot@example.com>
|
2024-03-05 14:08:41 +00:00
|
|
|
committer: Update Nightly Rustc Bot <bot@example.com>
|
2024-02-20 14:55:59 +00:00
|
|
|
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 }}
|
2024-03-02 14:34:24 +00:00
|
|
|
branch: create-pull-request/daily-nightly-update
|