From beaabc31e2bb8c0c21678abefd1e7a45b22707f5 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Wed, 8 Jan 2025 12:44:41 +0100 Subject: [PATCH] Add formatting action. --- .github/workflows/Format.yml | 50 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => Test.yml} | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/Format.yml rename .github/workflows/{ci.yml => Test.yml} (98%) diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml new file mode 100644 index 0000000..ecd9abe --- /dev/null +++ b/.github/workflows/Format.yml @@ -0,0 +1,50 @@ +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@v1 + with: + comment: 'Runic suggested the following formatting changes.' + event: 'COMMENT' + diff --git a/.github/workflows/ci.yml b/.github/workflows/Test.yml similarity index 98% rename from .github/workflows/ci.yml rename to .github/workflows/Test.yml index 4c7c8a4..2222e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/Test.yml @@ -1,4 +1,4 @@ -name: CI +name: Test on: push: branches: