FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
RustPython-test/.github/workflows/pr-auto-commit.yaml at main · RustPython/RustPython-test · GitHub
RustPython
RustPython-test
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
RustPython-test
/
.github
/
workflows
/
pr-auto-commit.yaml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
75 lines (65 loc) · 2.28 KB
Breadcrumbs
RustPython-test
/
.github
/
workflows
/
pr-auto-commit.yaml
Copy path
File metadata and controls
75 lines (65 loc) · 2.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name
:
Auto-format PR
#
This workflow triggers when a PR is opened/updated
on
:
pull_request_target
:
types
:
[opened, synchronize, reopened]
branches
:
-
main
-
release
concurrency
:
group
:
auto-format-${{ github.event.pull_request.number }}
cancel-in-progress
:
true
jobs
:
auto_format
:
if
:
${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
permissions
:
contents
:
write
pull-requests
:
write
runs-on
:
ubuntu-latest
timeout-minutes
:
60
steps
:
-
name
:
Checkout PR branch
uses
:
actions/checkout@v6
with
:
ref
:
${{ github.event.pull_request.head.sha }}
repository
:
${{ github.event.pull_request.head.repo.full_name }}
token
:
${{ secrets.AUTO_COMMIT_PAT }}
fetch-depth
:
0
-
name
:
Setup Rust
uses
:
dtolnay/rust-toolchain@stable
with
:
components
:
rustfmt
-
name
:
Run cargo fmt
run
:
|
echo "Running cargo fmt --all on PR #${{ github.event.pull_request.number }}"
cargo fmt --all
-
name
:
Configure git
run
:
|
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
-
name
:
Check for changes
id
:
check-changes
run
:
|
if [ -n "$(git status --porcelain)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
-
name
:
Commit and push formatting changes
if
:
steps.check-changes.outputs.has_changes == 'true'
run
:
|
git add -u
git commit -m "Auto-format: cargo fmt --all"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
-
name
:
Comment on PR
if
:
steps.check-changes.outputs.has_changes == 'true'
uses
:
marocchino/sticky-pull-request-comment@v2
with
:
number
:
${{ github.event.pull_request.number }}
message
:
|
**Code has been automatically formatted**
The code in this PR has been formatted using `cargo fmt --all`.
Please pull the latest changes before pushing again:
```bash
git pull origin ${{ github.event.pull_request.head.ref }}
```
Back
|
FazBrowse Home
|
New Git URL