I'm having a problem with correctly setting up CI using GitHub actions. I created one workflow with 2 jobs. First job autoformats the whole project using Google-Java-Style action. After success it creates a new commit with changes and starts a second action that runs ./gradlew build
. Build is failing every time on checkstyleMain task. I need to find a way to somehow "redirect" this second action to the new autoformat commit that includes the formatting changes.
My .yml
file looks like this:
name: Format and Build
on:
push:
workflow_dispatch:
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # v2 minimum required
- uses: axel-op/googlejavaformat-action@v3
with:
skip-commit: true
args: "--skip-sorting-imports --replace"
commit-message: "refactor: AUTO formatted by bot"
version: "1.16.0"
github-token: ${{ secrets.GITHUB_TOKEN }}
build:
needs: formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build with Gradle
run: ./gradlew build --no-daemon
I was trying to run this in second action ./gradlew build -x checkstyleMain
. It seems to work but I would prefer to overcome this problem, not just find the way around it.