|
| 1 | +name: Update Nightly rustc |
| 2 | +on: |
| 3 | + schedule: |
| 4 | + - cron: "0 0 * * 1,4" # runs every Monday and Thursday at 00:00 |
| 5 | + workflow_dispatch: # allows manual triggering |
| 6 | +jobs: |
| 7 | + format: |
| 8 | + name: Update nightly rustc |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - uses: dtolnay/rust-toolchain@nightly |
| 13 | + - name: Update rust.yml to use latest nightly |
| 14 | + run: | |
| 15 | + set -x |
| 16 | + # Not every night has a nightly, so extract the date from whatever |
| 17 | + # version of the compiler dtolnay/rust-toolchain gives us. |
| 18 | + NIGHTLY_DATE=$(rustc +nightly --verbose --version | sed -ne 's/^commit-date: //p') |
| 19 | + # Update the nightly version in the reference file. |
| 20 | + echo "nightly-${NIGHTLY_DATE}" > nightly-version |
| 21 | + echo "nightly_date=${NIGHTLY_DATE}" >> $GITHUB_ENV |
| 22 | + # Some days there is no new nightly. In this case don't make an empty PR. |
| 23 | + if ! git diff --exit-code > /dev/null; then |
| 24 | + echo "Updated nightly. Opening PR." |
| 25 | + echo "changes_made=true" >> $GITHUB_ENV |
| 26 | + else |
| 27 | + echo "Attempted to update nightly but the latest-nightly date did not change. Not opening any PR." |
| 28 | + echo "changes_made=false" >> $GITHUB_ENV |
| 29 | + fi |
| 30 | + - name: Create Pull Request |
| 31 | + if: env.changes_made == 'true' |
| 32 | + uses: peter-evans/create-pull-request@v6 |
| 33 | + with: |
| 34 | + token: ${{ secrets.APOELSTRA_CREATE_PR_TOKEN }} |
| 35 | + author: Update Nightly Rustc Bot <[email protected]> |
| 36 | + committer: Update Nightly Rustc Bot <[email protected]> |
| 37 | + title: Automated daily update to rustc (to nightly-${{ env.nightly_date }}) |
| 38 | + body: | |
| 39 | + Automated update to Github CI workflow `rust.yml` by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action |
| 40 | + commit-message: Automated update to Github CI to rustc nightly-${{ env.nightly_date }} |
| 41 | + branch: create-pull-request/daily-nightly-update |
0 commit comments