Hi team,
Is it okay if in my repository I have two files inside .github/workflows ? one build.yml for the complete analysis of the repository on CodePipeline, and a pr_build.yml for just PR decoration in GitHub Actions
build.yml
name: Build
on:
push:
branches:
- develop
- pre-production
- production
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
pr_build.yml
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: PR Decoration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
-Dsonar.pullrequest.provider=GitHub
I was doing a complete analysis on CodePipeline for testing with just with the pr_build.yml in my code, and this is the first time I do see a New Code and Overall Code results on the same branch. How do I interpret this behaviour?