Skip to content

Commit

Permalink
🤖 CI: Re-organize source formatter in CI build to fix env var
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelborn committed Feb 1, 2024
1 parent 6ba5d69 commit 32c9d9a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 40 deletions.
43 changes: 4 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,13 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
uses: ./.github/workflows/tests.yml

formatJava:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && env.SNAPSHOT == 'true'"
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

- name: Validate Java format
run: mvn --batch-mode -f pom.xml formatter:validate

- name: Commit Java Formatting Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '👌 IMPROVE: Apply mvn formatter:format changes - [ci skip]'

formatCFML:
runs-on: ubuntu-latest
needs: [ formatJava ]
if: "!contains(github.event.head_commit.message, '[ci skip]') && env.SNAPSHOT == 'true'"
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: Ortus-Solutions/[email protected]
with:
cmd: run-script format

- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '👌 IMPROVE: Apply cfformat changes - [ci skip]'


format:
if: "!contains(github.event.head_commit.message, '[ci skip]')"
uses: ./.github/workflows/format.yml

release:
runs-on: ubuntu-latest
needs: [ tests, formatJava, formatCFML ]
needs: [ tests, format ]
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Format Java and CFML Source Code

on:
workflow_call:

env:
SNAPSHOT: ${{ github.ref_name != 'main' && github.ref_name != 'master' }}

jobs:
formatJava:
runs-on: ubuntu-latest
if: ${{ env.SNAPSHOT == 'true' }}
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'

- name: Validate Java format
run: mvn --batch-mode -f pom.xml formatter:validate

- name: Commit Java Formatting Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '👌 IMPROVE: Apply mvn formatter:format changes - [ci skip]'

formatCFML:
runs-on: ubuntu-latest
needs: [ formatJava ]
if: ${{ env.SNAPSHOT == 'true' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: Ortus-Solutions/[email protected]
with:
cmd: run-script format

- name: Commit Format Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '👌 IMPROVE: Apply cfformat changes - [ci skip]'
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: Ortus-Solutions/[email protected].2
- uses: Ortus-Solutions/[email protected].3
with:
cmd: run-script format:check

0 comments on commit 32c9d9a

Please sign in to comment.