openrewrite / openrewrite/rewrite-github-actions
Set `fetch-depth` to 0 for workflows using Sonar
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1
- Forks
- 9
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 12
Description
This recipe should :
- Detect usages of actions/checkout and Sonar
- Change the
fetch-depthto 0 for actions/checkout
Example pull request : https://github.com/kobylynskyi/graphql-java-codegen/pull/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:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the recipe that scans workflows for actions/checkout and Sonar usage, using the .github/workflows/github.yml example as a reference. Check Gradle, Maven, wrapper, and sonarqube-action cases; done means each matching checkout step has fetch-depth set to 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, java
- Domain
- ci-cd, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100