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

Prevent SonarQube running on fork #189

Merged
merged 3 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,10 @@ jobs:
- name: Check style
run: ./gradlew checkstyleMain checkstyleTest

- name: Build and analyze
- name: Build
id: build_jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./gradlew build jacocoTestReport sonar --info
./gradlew build --info
echo current_version=$(echo $(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')) >> $GITHUB_OUTPUT

- name: Publish test report
Expand All @@ -60,6 +57,13 @@ jobs:
name: kafkactl-jar
path: ${{ github.workspace }}/build/libs/kafkactl-${{ steps.build_jar.outputs.current_version }}.jar

- name: Sonar
if: github.event.pull_request.head.repo.fork == false
run: ./gradlew jacocoTestReport sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Docker
run: ./gradlew dockerBuild

Expand Down Expand Up @@ -153,4 +157,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: kafkactl-windows-amd64
path: ${{ github.workspace }}/build/native/nativeCompile/kafkactl-${{ steps.build_native_windows.outputs.current_version }}-windows-amd64.exe
path: ${{ github.workspace }}/build/native/nativeCompile/kafkactl-${{ steps.build_native_windows.outputs.current_version }}-windows-amd64.exe
13 changes: 8 additions & 5 deletions .github/workflows/push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ jobs:
- name: Check style
run: ./gradlew checkstyleMain checkstyleTest

- name: Build and analyze
- name: Build
id: build_jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./gradlew build jacocoTestReport sonar --info
./gradlew build --info
echo current_version=$(echo $(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')) >> $GITHUB_OUTPUT

- name: Publish test report
Expand All @@ -65,6 +62,12 @@ jobs:
name: kafkactl-jar
path: ${{ github.workspace }}/build/libs/kafkactl-${{ steps.build_jar.outputs.current_version }}.jar

- name: Sonar
run: ./gradlew jacocoTestReport sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Docker
run: ./gradlew dockerBuild dockerPush

Expand Down
Loading