diff --git a/.github/workflows/Formatting.yml b/.github/workflows/Formatting.yml new file mode 100644 index 000000000..fd09d5101 --- /dev/null +++ b/.github/workflows/Formatting.yml @@ -0,0 +1,49 @@ +name: 'Format' + +on: + pull_request: + paths: ['**/*.jl'] + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + + # needed for julia-actions/cache to delete old caches + actions: write + + # needed for parkerbxyz/suggest-changes + pull-requests: write + +jobs: + runic: + runs-on: ubuntu-latest + if: github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Julia + uses: julia-actions/setup-julia@v2 + with: + version: '1' + arch: 'x64' + - uses: julia-actions/cache@v2 + + - name: Install Runic + run: | + julia --project=@runic -e 'using Pkg; Pkg.add("Runic")' + curl -o git-runic https://raw.githubusercontent.com/fredrikekre/Runic.jl/master/bin/git-runic + chmod +x git-runic + + - name: Run Runic + run: | + set +e + ./git-runic origin/main + [ $? -eq 2 ] && exit 1 || exit 0 + + - name: Suggest changes + uses: parkerbxyz/suggest-changes@v2 + with: + comment: 'Runic suggested the following formatting changes.' + event: 'COMMENT' diff --git a/.github/workflows/runic.yml b/.github/workflows/runic.yml deleted file mode 100644 index d512f9de7..000000000 --- a/.github/workflows/runic.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Runic formatting -on: - push: - branches: - - 'master' - - 'release-' - tags: - - '*' - pull_request: -jobs: - runic: - name: Runic - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v2 - with: - version: "nightly" # Only nightly have the -m flag currently - - uses: julia-actions/cache@v2 - - name: Install Runic - run: | - julia --color=yes --project=@runic -e 'using Pkg; Pkg.add(url = "https://github.com/fredrikekre/Runic.jl", rev = "e128bc9b77ea44b8fe23a0c3afe741a19c71a7b2")' - - name: Run Runic - run: | - git ls-files -z -- '*.jl' | xargs -0 julia --project=@runic -m Runic --check --diff