-
Notifications
You must be signed in to change notification settings - Fork 13
39 lines (35 loc) · 1.22 KB
/
Copy pathfmt-command.yml
File metadata and controls
39 lines (35 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Format Command
on:
repository_dispatch:
types: [fmt-command]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: cargo fmt
id: fmt
run: |
format=$(cargo fmt --check --quiet || echo "true")
echo "format=$format" >> $GITHUB_OUTPUT
- name: Commit to the PR branch
if: steps.fmt.outputs.format == 'true'
run: |
cargo fmt
git config --global user.name 'actions-bot'
git config --global user.email '58130806+actions-bot@users.noreply.github.com'
git commit -am ":art:"
git push
- name: Add reaction
uses: peter-evans/create-or-update-comment@v5
with:
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: hooray
reactions-edit-mode: replace