update-gradle-wrapper-action
update-gradle-wrapper-action copied to clipboard
action fails, possibly due to git fetch with --depth=1
My gradle build requires the full git history to be available as a version string is inferred from the git history based on tags and commits using the gradle plugin me.qoomon.git-versioning.
I check out my repo with a fetch-depth of 0, but when the update gradle wrapper action runs it executes a /usr/bin/git fetch --depth=1 which might be the problem.
Here is my github workflow:
name: Update Gradle Wrapper
on:
schedule:
# run every Sunday at 13:28
- cron: "28 13 * * 0"
workflow_dispatch:
permissions:
contents: read
jobs:
update-gradle-wrapper:
permissions:
# for gradle-update/update-gradle-wrapper-action
contents: write
# for gradle-update/update-gradle-wrapper-action
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# fetch the complete git history; required by update-gradle-wrapper-action
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# this action doesn't work but is still useful as it only fails (and sends a notification) if a new version of gradle is actually available
- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v1
with:
repo-token: ${{ secrets.PAT_UPDATE_GRADLE_WRAPPER_ACTION }}
labels: "type: library-update"
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1```
The workflow fails at the step Update Gradle Wrapper and this is the output that I get from that step:
Run uli-f/[email protected]
with:
repo-token: ***
labels: type: library-update
set-distribution-checksum: true
release-channel: stable
pr-title-template: Update Gradle Wrapper from %sourceVersion% to %targetVersion%
env:
JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-7/x64
JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-7/x64
/usr/bin/git config --local http.https://github.com/.extraheader Authorization: basic ***
Latest release: 8.3 (channel stable)
/usr/bin/git config --local user.name gradle-update-robot
/usr/bin/git config --local user.email [email protected]
/usr/bin/git fetch --depth=1
/usr/bin/git checkout main
Already on 'main'
Your branch is up to date with 'origin/main'.
/usr/bin/git rev-parse HEAD
b428f6479b8708e19e4b3445aec8a62d30ae48f2
Creating branch
/usr/bin/git checkout -b gradlew-update-8.3 b428f6479b8708e19e4b3445aec8a62d30ae48f2
Switched to a new branch 'gradlew-update-8.3'
Working with Wrapper at: /home/runner/work/*****/*****/gradle/wrapper/gradle-wrapper.properties
Updating Wrapper
/home/runner/work/*****/*****/gradlew wrapper --gradle-version 8.3 --distribution-type bin --gradle-distribution-sha256-sum 591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225
Downloading https://services.gradle.org/distributions/gradle-8.2.1-bin.zip
............10%............20%............30%.............40%............50%............60%............70%.............80%............90%............100%
Welcome to Gradle 8.2.1!
Here are the highlights of this release:
- Kotlin DSL: new reference documentation, assignment syntax by default
- Kotlin DSL is now the default with Gradle init
- Improved suggestions to resolve errors in console output
- Reduced sync memory consumption
For more details see https://docs.gradle.org/8.2.1/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
Gradle version: 8.2.1
gather git situation from GitHub Actions environment variable: GITHUB_REF
matching ref: COMMIT - b428f6479b8708e19e4b3445aec8a62d30ae48f2
ref configuration: COMMIT - pattern: null
version: ${describe.tag}-${describe.distance}-${commit.short}
FAILURE: Build failed with an exception.
* Where:
Build file '/home/runner/work/******/******/build.gradle' line: 35
* What went wrong:
A problem occurred evaluating root project '*****'.
> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: couldn't find matching tag in shallow git repository
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org./
BUILD FAILED in 38s
Error: ❌ FAILURE: Build failed with an exception.
* Where:
Build file '/home/runner/work/*****/*****/build.gradle' line: 35
* What went wrong:
A problem occurred evaluating root project '*****'.
> java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: couldn't find matching tag in shallow git repository
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org./
BUILD FAILED in 38s