The primary CI workflow should remain deterministic and reviewable, but simple formatting and auto-fixable lint failures are still noisy and time-consuming to clean up by hand.
- Keep
CIas a check-only workflow. - Run a separate workflow automatically after a failed
CIrun. - Apply
gofmtandgolangci-lint --fixon same-repository branches. - Push fixes back to the branch and explicitly re-dispatch
CIon the updated branch head. - Reuse the same lifecycle behavior for repositories bootstrapped by
climate publish.
- Auto-fixing test, build, or
go vetfailures. - Pushing changes to forked pull request branches.
- Rewriting user-managed workflow files that do not carry the climate marker.
CIruns onpush,pull_request, andworkflow_dispatch.CI Auto-Fixlistens for failedCIcompletions viaworkflow_run.- The auto-fix job only runs when the failing branch belongs to the same repository and the branch head still matches the SHA that failed.
- The job runs
gofmt -w .andgolangci-lint --fix. - If changes were produced, the workflow commits and pushes them, then calls
the Actions dispatch API to run
CIagain on that branch.
- If the branch advanced after the failing
CIrun, the auto-fix job exits without writing to a stale branch state. - If the failure is not auto-fixable, the workflow exits cleanly with no commit.
- A push created with
GITHUB_TOKENdoes not triggerpushworkflows, so the explicit re-dispatch step is required for the fixed commit to get a freshCIrun.