Skip to content

Commit

Permalink
Update azure templates not to run sonar cloud tasks when the build is…
Browse files Browse the repository at this point in the history
… a pull request comming from a fork (#142)
  • Loading branch information
coenm authored Sep 4, 2024
1 parent 22091ac commit 3352f53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .azuredevops/Pipelines/Templates/prepare-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ steps:
projectName: RepoM
extraProperties: |
sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/*.trx
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*.opencover.xml
sonar.cs.opencover.reportsPaths=$(Agent.TempDirectory)/**/*.opencover.xml
condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )

2 changes: 2 additions & 0 deletions .azuredevops/Pipelines/Templates/publish-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ steps:

- task: SonarCloudAnalyze@2
displayName: ⚙️ Run Code Analysis
condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )

- task: SonarCloudPublish@2
displayName: 📢 Publish Quality Gate Result
condition: or( ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.PullRequest.IsFork'], 'false') )

- pwsh: |
dotnet tool install --tool-path . dotnet-reportgenerator-globaltool
Expand Down

0 comments on commit 3352f53

Please sign in to comment.