Skip to content

Add option to format only some paths #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
- uses: julia-actions/julia-format@v4
with:
version: '1' # Set `version` to '1.0.54' if you need to use JuliaFormatter.jl v1.0.54 (default: '1')
suggestion-label: 'format-suggest' # leave this unset or empty to show suggestions for all PRs
suggestion-label: 'format-suggest' # Leave this unset or empty to show suggestions for all PRs
paths: 'src/, test/' # Leave this unset to format every file
```

With this workflow, [reviewdog](https://github.com/reviewdog/reviewdog) will automatically post code suggestions to pull requests in your repository, based on the formatting rules defined by [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl).
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
suggestion-label:
description: 'If set, suggestions will only be shown for PRs with this label applied.'
default: ''
paths:
description: 'A comma-separated list of paths (folders or files) to be formatted'
default: '.'
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -45,7 +48,10 @@ runs:
shell: julia --color=yes {0}
run: |
import JuliaFormatter
JuliaFormatter.format(".")
paths = strip.(split(get(ENV, "jf-paths", "."), ","))
JuliaFormatter.format(paths)
env:
jf-paths: ${{ inputs.paths }}
- name: Check for formatting errors
shell: bash
run: |
Expand Down