spotless: ratchetFrom 'origin/main' does not fetch if not present
If you specify rachetFrom and the branch doesn’t exist locally, it should be fetched by the ratchet infrastructure.
https://github.com/JLLeitschuh/spotless/runs/1200916598?check_suite_focus=true#step:5:56
[2020-10-02 21:07:06] [autobuild] * What went wrong:
[2020-10-02 21:07:06] [autobuild] A problem occurred evaluating project ':ide'.
[2020-10-02 21:07:06] [autobuild] > Could not create task ':lib:spotlessJava'.
[2020-10-02 21:07:06] [autobuild] > No such reference 'origin/main'
EDIT: Summary of workarounds from below
- GitHub Actions: add
fetch-depth: 0to<action>.yml - GitLab CI: add
GIT_DEPTH: 0under thevariables:section of.gitlab-ci.yml - BitBucket Pipelines:
clone: depth: full - Travis:
git: depth: false
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 26 (18 by maintainers)
Commits related to this issue
- Clone full repo to allow for spotless ratcheting * Workaround until spotless fetches ratchetFrom base automatically * Details: https://github.com/diffplug/spotless/issues/710 — committed to brevilo/jolm by brevilo 3 years ago
- Fix CI job, clickEvent CI would fail due to spotless not doing a full checkout. More information here: https://github.com/diffplug/spotless/issues/710 Fix clickEvent not being reachable. Added cop... — committed to GalaxeTV/GalaxeSMP by garrettsummerfi3ld 2 years ago
- spotless issue: https://github.com/diffplug/spotless/issues/710 — committed to abendt/aws-kinesis by abendt 7 months ago
I would use environment variables and do something like:
Easy short-term fix?
→ Internally convert all spotless tasks to no-ops when the
ratchetFrombranch can’t be found.origin/upstreamremote ref.spotlessApplyinto the local build steps.Anyone using travis can override by adding the following in the
travis.ymlIn case anyone runs into this issue with BitBucket Pipelines, adding
clone: depth: fullto the build step resolved it for me.Let’s keep it open, I still think it’s a good idea.