Skip to content

Commit 685fa49

Browse files
committed
draft autoformat bot
1 parent c001dab commit 685fa49

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/workflows/prprecommit.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: PR Pre-Commit Bot
2+
env:
3+
JULIA_NUM_THREADS: 2
4+
on:
5+
pull_request:
6+
branches: ["master", "main"]
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
with:
14+
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
15+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
16+
- name: Setup Julia
17+
uses: julia-actions/setup-julia@v2
18+
with:
19+
version: '1'
20+
- name: Setup JuliaFormatter
21+
run: |
22+
julia -e '
23+
using Pkg
24+
Pkg.add(name="JuliaFormatter", version="1.0.62")'
25+
- name: Setup Python
26+
uses: actions/setup-python@v3
27+
- name: Run pre-commit
28+
uses: pre-commit/[email protected]
29+
- name: Commit files
30+
run: |
31+
git config --local user.email "[email protected]"
32+
git config --local user.name "PR Pre-Commit Bot"
33+
git diff-index --quiet HEAD || git commit -m "add bot commits" -a
34+
- name: Push changes
35+
uses: ad-m/[email protected]
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
branch: ${{ github.head_ref }}

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: "https://github.com/domluna/JuliaFormatter.jl"
3+
rev: "v1.0.62"
4+
hooks:
5+
- id: "julia-formatter"

0 commit comments

Comments
 (0)