Skip to content

Commit

Permalink
Merge pull request #340 from orphan-oss/feature/branch-name
Browse files Browse the repository at this point in the history
Extracts current branch name
  • Loading branch information
lukaszlenart authored Dec 29, 2024
2 parents 9cbf879 + ea3c8b9 commit 5874835
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ jobs:
cache: 'maven'
- name: Build with Maven
run: ./mvnw -B -V package -DskipTests=true
- name: SonarCloud Scan on ${GITHUB_REF##*/}
- name: Get branch name
id: get-branch-name
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_OUTPUT
else
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
fi
shell: bash
- name: SonarCloud Scan on ${{ steps.get-branch-name.outputs.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: ${{ github.ref == 'refs/heads/main' }}
run: ./mvnw -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.branch.name=${GITHUB_REF##*/}
run: ./mvnw -B -V -Pcoverage verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.branch.name=${{ steps.get-branch-name.outputs.BRANCH_NAME }}

0 comments on commit 5874835

Please sign in to comment.