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

Set fetch-depth to 0 for workflows using Sonar #62

Open
yeikel opened this issue Mar 24, 2023 · 0 comments
Open

Set fetch-depth to 0 for workflows using Sonar #62

yeikel opened this issue Mar 24, 2023 · 0 comments
Labels

Comments

@yeikel
Copy link
Contributor

yeikel commented Mar 24, 2023

This recipe should :

  1. Detect usages of actions/checkout and Sonar
  2. Change the fetch-depth to 0 for actions/checkout

Example pull request : kobylynskyi/graphql-java-codegen#1061

diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml
index 78fa738a..6b6710b0 100644
--- a/.github/workflows/github.yml
+++ b/.github/workflows/github.yml
@@ -86,7 +86,8 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-
+        with:
+         fetch-depth: 0
       - name: Setup Java
         uses: actions/setup-java@v1
         with:

There are a few ways to run Sonar as far as I know :

Gradle :

 ./gradlew sonarqube ...
 gradle sonarqube ...

Maven :

 mvn sonar:sonar 
 ./mvnw sonar:sonar 

Using sonarqube-action

Additional information : https://community.sonarsource.com/t/git-fetch-depth-implications/75260

Common error after results are processed:

image

@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants