Skip to content

"Auto-commit if spotlessApply has changes" workflow job failed unexpectedly #573

@ithinkihaveacat

Description

@ithinkihaveacat

The "Auto-commit if spotlessApply has changes" workflow job can fail with a misleading error message. While the log may suggest a non-existent branch, the root cause is often an uncommitted change from a previous step (example failure).

Root Cause

The failure is a symptom of a cascading issue:

  1. A preceding job (e.g., "Run spotlessApply for Wear") modifies a file to fix a style violation but still exits with a success code.
  2. Because source files were modified, the conditional "Auto-commit..." job is triggered.
  3. The Auto-commit job then fails due to the unexpected repository state.

This is confusing because the UI marks all previous jobs as successful, making it seem like the Auto-commit job is the only problem.

Workaround

The workaround is to run the spotlessApply tasks locally to find and commit the file modifications.

  1. Manually execute each job of the workflow until you find one that modifies a file. For example:
    ./gradlew :wear:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
  2. Commit the change that the command made (example).
  3. Push the commit. The workflow should now complete successfully, as the Auto-commit step will have nothing to do.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions