-
Notifications
You must be signed in to change notification settings - Fork 13
/
action.yml
44 lines (44 loc) · 1.38 KB
/
action.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
name: 'Format suggestion with JuliaFormatter.jl'
description: "Formats your Julia files and suggest changes"
inputs:
version:
description: 'Version of JuliaFormatter.jl. Examples: 1, 1.0, 1.0.44'
default: '1'
suggestion-label:
description: 'If set, suggestions will only be shown for PRs with this label applied.'
default: ''
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
- uses: julia-actions/cache@v1
- name: 'Install JuliaFormatter'
run: |
julia -e '
using Pkg
Pkg.add(Pkg.PackageSpec(name="JuliaFormatter", version=get(ENV, "jf-version", "1")))'
shell: bash
env:
jf-version: ${{ inputs.version }}
- name: 'Format'
run: |
julia -e '
using JuliaFormatter
format(".")'
shell: bash
- name: Check for formatting errors
shell: bash
run: |
output=$(git diff --name-only)
if [ "$output" != "" ]; then
>&2 echo "Some files have not been formatted !!!"
echo "$output"
exit 1
fi
- name: 'Suggest'
uses: reviewdog/action-suggester@v1
if: ${{ failure() && (inputs.suggestion-label == '' || contains( github.event.pull_request.labels.*.name, inputs.suggestion-label )) }}
with:
tool_name: JuliaFormatter
fail_on_error: true