Skip to content

Commit 32d49e9

Browse files
committed
Add weekly CI job running cargo +nightly fmt
1 parent 9ae5ff8 commit 32d49e9

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Nightly rustfmt
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
schedule:
9+
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
10+
workflow_dispatch: # allows manual triggering
11+
jobs:
12+
format:
13+
name: Nightly rustfmt
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v5
17+
- uses: dtolnay/rust-toolchain@nightly
18+
with:
19+
components: rustfmt
20+
- name: Run Nightly rustfmt
21+
# Run the formatter and manually remove trailing whitespace.
22+
run: cargo +nightly fmt && git ls-files -- '*.rs' -z | xargs sed -E -i'' -e 's/[[:space:]]+$//'
23+
- name: Get the current date
24+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v7
27+
with:
28+
author: Fmt Bot <bot@example.com>
29+
title: Automated nightly rustfmt (${{ env.date }})
30+
body: |
31+
Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
32+
commit-message: ${{ env.date }} automated rustfmt nightly
33+
labels: rustfmt

0 commit comments

Comments
 (0)