Skip to content

Commit 2590ee5

Browse files
committed
Add weekly cronjob running cargo +nightly fmt
.. which we steal from `rust-bitcoin`.
1 parent a73d090 commit 2590ee5

File tree

1 file changed

+28
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)