Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/julia-actions/julia-format
GitHub action for JuliaFormatter.jl
https://github.com/julia-actions/julia-format
Last synced: about 1 month ago
JSON representation
GitHub action for JuliaFormatter.jl
- Host: GitHub
- URL: https://github.com/julia-actions/julia-format
- Owner: julia-actions
- License: mit
- Created: 2019-09-07T19:05:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-06T06:41:44.000Z (6 months ago)
- Last Synced: 2024-07-06T07:22:43.805Z (6 months ago)
- Homepage:
- Size: 50.8 KB
- Stars: 43
- Watchers: 6
- Forks: 13
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# julia-format
## Setup workflow with `julia-format` action
> [!IMPORTANT]
> Starting with v3 of this action, unformatted code in files that are not part of the current PR will cause the action to fail.Save the following code as `Format.yml` in the `.github/workflows/` directory in your repository.
```yaml
name: Format suggestions
on:
pull_request:
# this argument is not required if you don't use the `suggestion-label` input
types: [ opened, reopened, synchronize, labeled, unlabeled ]
jobs:
code-style:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/julia-format@v3
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
```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).
## Another possible workflow without `julia-format` action
You can also create another workflow like this:
```yaml
name: format-pr
on:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/cache@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'import Pkg; Pkg.add("JuliaFormatter")'
julia -e 'using JuliaFormatter; format(".")'# https://github.com/marketplace/actions/create-pull-request
# https://github.com/peter-evans/create-pull-request#reference-example
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Format .jl files
title: 'Automatic JuliaFormatter.jl run'
branch: auto-juliaformatter-pr
delete-branch: true
labels: formatting, automated pr, no changelog
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
```This workflow does not check the code in PRs, but creates PRs to fix the format.