Skip to content

Commit f0854b2

Browse files
authored
fmt
Updated the GitHub Actions workflow for formatting and building Rust code. Changed checkout action version, modified toolchain installation, and improved commit and push steps.
1 parent 1b0c240 commit f0854b2

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

.github/workflows/fmt.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: fmt
1+
name: Manual Auto Format and Build
22

33
on:
44
workflow_dispatch:
@@ -8,20 +8,13 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v4
12-
with:
13-
token: ${{ secrets.GITHUB_TOKEN }}
14-
ref: refs/heads/${{ github.event.inputs.branch }}
11+
- uses: actions/checkout@v3
1512

16-
# Using the requested deprecated toolchain action
1713
- name: Install Rust Toolchains
1814
uses: actions-rs/toolchain@v1
1915
with:
20-
toolchain: stable
21-
override: true
22-
components: rustfmt, clippy
16+
components: rustfmt
2317

24-
# Using the requested cache action
2518
- name: Cache Rust Build Artifacts
2619
uses: Swatinem/rust-cache@v2
2720

@@ -31,13 +24,19 @@ jobs:
3124
- name: Run cargo build
3225
run: cargo build --verbose
3326

34-
- name: Commit and Push Formatted Changes
27+
- name: Commit changes
3528
if: success()
3629
run: |
3730
if [ -n "$(git status --porcelain)" ]; then
3831
git config user.name 'github-actions[bot]'
3932
git config user.email 'github-actions[bot]@users.noreply.github.com'
4033
git add .
41-
git commit -m "fmt"
42-
git push origin ${{ github.event.inputs.branch }}
34+
git commit -m fmt
4335
fi
36+
37+
- name: Push Formatted Changes
38+
uses: ad-m/github-push-action@v0.6.0
39+
if: success()
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }
42+
branch: ${{ github.ref_name }}

0 commit comments

Comments
 (0)