File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,8 +38,29 @@ steps:
3838- script : |
3939 curl -Os https://cli.codecov.io/latest/linux/codecov
4040 chmod +x codecov
41- ./codecov --verbose upload-process --disable-search --git-service github -f $(Pipeline.Workspace)/AggregatedCoverage/Cobertura.xml
41+
42+ # Build the base command
43+ CMD="./codecov --verbose upload-process \
44+ --disable-search \
45+ --git-service github \
46+ --slug microsoft/fhir-server \
47+ -f $(Pipeline.Workspace)/AggregatedCoverage/Cobertura.xml"
48+
49+ # For PR builds, use the PR head commit and source branch so Codecov
50+ # can associate the upload with the correct pull request.
51+ if [ "$BUILD_REASON" = "PullRequest" ]; then
52+ CMD="$CMD --sha $PR_HEAD_SHA --branch $PR_SOURCE_BRANCH --pr $PR_NUMBER"
53+ else
54+ CMD="$CMD --sha $(Build.SourceVersion) --branch $(Build.SourceBranch)"
55+ fi
56+
57+ echo "Running: $CMD"
58+ eval $CMD
4259 displayName : ' Upload coverage to Codecov'
4360 condition : succeededOrFailed()
4461 env :
4562 CODECOV_TOKEN : $(CODECOV_TOKEN)
63+ BUILD_REASON : $(Build.Reason)
64+ PR_HEAD_SHA : $(System.PullRequest.SourceCommitId)
65+ PR_SOURCE_BRANCH : $(System.PullRequest.SourceBranch)
66+ PR_NUMBER : $(System.PullRequest.PullRequestNumber)
You can’t perform that action at this time.
0 commit comments