-
-
Notifications
You must be signed in to change notification settings - Fork 45
53 lines (44 loc) · 1.36 KB
/
format.yml
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
name: Format Markdown Files
on:
pull_request:
branches:
- '*'
jobs:
format:
if: '! github.event.pull_request.draft'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Julia
uses: julia-actions/setup-julia@v1
with:
version: 1.9
- name: Install JuliaFormatter.jl
run: julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
- name: Get Changed Files
id: changed_files
uses: tj-actions/[email protected]
with:
files: |
**/*.md
- name: Format Markdown Files
run: |
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do
julia format_myst.jl "$file"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git diff-index --quiet HEAD || git commit -m "Apply formatting to Markdown files"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}