nightly-rustfmt.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. name: Nightly rustfmt
  2. on:
  3. schedule:
  4. - cron: "0 0 * * *" # runs daily at 00:00 UTC
  5. workflow_dispatch: # allows manual triggering
  6. permissions: {}
  7. jobs:
  8. format:
  9. name: Nightly rustfmt
  10. runs-on: self-hosted
  11. permissions:
  12. contents: write
  13. pull-requests: write
  14. steps:
  15. - uses: actions/checkout@v4
  16. with:
  17. ref: main
  18. token: ${{ secrets.BACKPORT_TOKEN }}
  19. - uses: cachix/cachix-action@v16
  20. with:
  21. name: cashudevkit
  22. authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
  23. useDaemon: false
  24. continue-on-error: true
  25. - name: Run Nightly rustfmt
  26. run: |
  27. nix develop -i -L .#nightly --command bash -c '
  28. # Force use of Nix-provided rustfmt
  29. export RUSTFMT=$(command -v rustfmt)
  30. cargo fmt
  31. '
  32. # Manually remove trailing whitespace
  33. find . -name '*.rs' -type f -exec sed -E -i 's/[[:space:]]+$//' {} +
  34. - name: Get the current date
  35. run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
  36. - name: Create Pull Request
  37. uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
  38. env:
  39. PRE_COMMIT_ALLOW_NO_CONFIG: 1
  40. with:
  41. token: ${{ secrets.BACKPORT_TOKEN }}
  42. author: Fmt Bot <bot@cashudevkit.org>
  43. title: Automated nightly rustfmt (${{ env.date }})
  44. body: |
  45. Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
  46. commit-message: ${{ env.date }} automated rustfmt nightly
  47. labels: rustfmt
  48. branch: automated-rustfmt-${{ env.date }}