run JuliaFormatter on schedule

This commit is contained in:
t-bltg 2021-08-19 17:45:06 +02:00
parent 214663aa4b
commit 35fd604e07
2 changed files with 39 additions and 7 deletions

View File

@ -5,7 +5,8 @@ on:
jobs: jobs:
JuliaFormatter: JuliaFormatter:
if: "!contains(github.event.head_commit.message, '[skip ci]')" if: false
# if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -13,14 +14,10 @@ jobs:
with: with:
version: 1 version: 1
# Setup
- name: Ubuntu TESTCMD
run: echo "TESTCMD=xvfb-run --auto-servernum julia" >> $GITHUB_ENV
# Check format # Check format
- name: Install JuliaFormatter and format - name: Install JuliaFormatter and format
run: | run: |
git diff --name-only --exit-code git diff --name-only --exit-code
$TESTCMD -e 'using Pkg; pkg"add JuliaFormatter CSTParser#master"' julia -e 'using Pkg; pkg"add JuliaFormatter CSTParser#master"'
$TESTCMD -e 'using JuliaFormatter; format(["src", "test"])' julia -e 'using JuliaFormatter; [format(["src", "test"]) for _ in 1:2]'
git diff --exit-code git diff --exit-code

35
.github/workflows/format_pr.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: format-pr
on:
schedule:
- cron: '0 0 * * SUN'
jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'import Pkg; pkg"add JuliaFormatter CSTParser#master"'
julia -e 'using JuliaFormatter; [format(["src", "test"]) for _ in 1:2]'
git diff --exit-code
- name: Create Pull Request
if: ${{ failure() }}
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Format .jl files [skip ci]"
title: 'Automatic JuliaFormatter.jl run'
branch: auto-juliaformatter-pr
delete-branch: true
labels: formatting, automated pr, no changelog
- name: Check outputs
if: ${{ failure() }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"