File tree Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Format check
2+ on :
3+ push :
4+ branches : [master]
5+ tags : [v*]
6+ pull_request :
7+
8+ jobs :
9+ format :
10+ name : " Format Check"
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v2
14+ - uses : julia-actions/setup-julia@v1
15+ with :
16+ version : 1
17+ - name : Install JuliaFormatter and format
18+ run : |
19+ julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
20+ julia -e 'using JuliaFormatter; format(".", verbose=true)'
21+ - name : Check format
22+ run : |
23+ julia -e '
24+ out = Cmd(`git diff --name-only`) |> read |> String
25+ if out == ""
26+ exit(0)
27+ else
28+ @error "The following files have not been formatted:"
29+ write(stdout, out)
30+ out_diff = Cmd(`git diff`) |> read |> String
31+ @error "Diff:"
32+ write(stdout, out_diff)
33+ exit(1)
34+ @error ""
35+ end'
Original file line number Diff line number Diff line change 1+ name : format-pr
2+ on :
3+ schedule :
4+ - cron : ' 0 0 * * *'
5+ jobs :
6+ build :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v2
10+ - name : Install JuliaFormatter and format
11+ run : |
12+ julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
13+ julia -e 'using JuliaFormatter; format(".")'
14+ # https://github.com/marketplace/actions/create-pull-request
15+ # https://github.com/peter-evans/create-pull-request#reference-example
16+ - name : Create Pull Request
17+ id : cpr
18+ uses : peter-evans/create-pull-request@v3
19+ with :
20+ token : ${{ secrets.GITHUB_TOKEN }}
21+ commit-message : Format .jl files
22+ title : ' Automatic JuliaFormatter.jl run'
23+ branch : auto-juliaformatter-pr
24+ delete-branch : true
25+ labels : formatting, automated pr, no changelog
26+ - name : Check outputs
27+ run : |
28+ echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
29+ echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
Original file line number Diff line number Diff line change 1+ name : Format suggestions
2+
3+ on :
4+ pull_request :
5+
6+ concurrency :
7+ # Skip intermediate builds: always.
8+ # Cancel intermediate builds: only if it is a pull request build.
9+ group : ${{ github.workflow }}-${{ github.ref }}
10+ cancel-in-progress : ${{ startsWith(github.ref, 'refs/pull/') }}
11+
12+ jobs :
13+ format :
14+ runs-on : ubuntu-latest
15+ steps :
16+ - uses : actions/checkout@v2
17+ - uses : julia-actions/setup-julia@latest
18+ with :
19+ version : 1
20+ - run : |
21+ julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
22+ julia -e 'using JuliaFormatter; format("."; verbose=true)'
23+ - uses : reviewdog/action-suggester@v1
24+ with :
25+ tool_name : JuliaFormatter
26+ fail_on_error : true
27+ filter_mode : added
You can’t perform that action at this time.
0 commit comments