Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action fails, possibly due to git fetch with --depth=1 #760

Open
uli-f opened this issue Sep 8, 2023 · 0 comments
Open

action fails, possibly due to git fetch with --depth=1 #760

uli-f opened this issue Sep 8, 2023 · 0 comments

Comments

@uli-f
Copy link

uli-f commented Sep 8, 2023

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/update-gradle-wrapper-action@v1.0.21
  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 gradle-update-robot@regolo.cc
/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant