Skip to content

Commit e49f9f5

Browse files
authored
Update base commit of code coverage (#8316)
The code coverage is comparing a merge commit to the common commit of a PR and the target branch. This will involve changes between this common commit and the latest commit of the target branch. This update will switch the common commit of the PR to the latest commit on the target branch.
1 parent 635283b commit e49f9f5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/test_coverage.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
pr_branch: ${{ github.event.pull_request.head.ref }}
4040
run: |
4141
if [ ! -z "${{ env.METRICS_SERVICE_SECRET }}" ]; then
42-
./scripts/code_coverage_report/get_updated_files.sh
42+
./scripts/code_coverage_report/get_updated_files.sh
4343
fi
4444
4545
pod-lib-lint-abtesting:
@@ -282,13 +282,12 @@ jobs:
282282
- name: Compare Diff and Post a Report
283283
if: github.event.pull_request.merged != true && github.event.action != 'closed' && env.METRICS_SERVICE_SECRET != ''
284284
env:
285-
base_commit: ${{ needs.check.outputs.base_commit }}
285+
base_commit: ${{ ${{ github.event.pull_request.base.sha }} }}
286286
run: |
287287
# Get Head commit of the branch, instead of a merge commit created by actions/checkout.
288-
GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha)
289288
if [ -d "${{steps.download.outputs.download-path}}" ]; then
290-
cd scripts/code_coverage_report/generate_code_coverage_report
291-
swift run CoverageReportGenerator --presubmit "firebase/firebase-ios-sdk" --head-commit "${GITHUB_SHA}" --token $(gcloud auth print-identity-token) --xcresult-dir "/Users/runner/test/codecoverage" --log-link "https://github.com/firebase/firebase-ios-sdk/actions/runs/${GITHUB_RUN_ID}" --pull-request-num ${{github.event.pull_request.number}} --base-commit "$base_commit"
289+
cd scripts/code_coverage_report/generate_code_coverage_report
290+
swift run CoverageReportGenerator --presubmit "firebase/firebase-ios-sdk" --head-commit "${GITHUB_SHA}" --token $(gcloud auth print-identity-token) --xcresult-dir "/Users/runner/test/codecoverage" --log-link "https://github.com/firebase/firebase-ios-sdk/actions/runs/${GITHUB_RUN_ID}" --pull-request-num ${{github.event.pull_request.number}} --base-commit "$base_commit"
292291
fi
293292
- name: Incremental Code Coverage
294293
if: github.event.pull_request.merged != true && github.event.action != 'closed'
@@ -319,6 +318,6 @@ jobs:
319318
if: github.event.pull_request.merged && env.METRICS_SERVICE_SECRET != ''
320319
run: |
321320
if [ -d "${{steps.download.outputs.download-path}}" ]; then
322-
cd scripts/code_coverage_report/generate_code_coverage_report
323-
swift run CoverageReportGenerator --merge "firebase/firebase-ios-sdk" --head-commit "${GITHUB_SHA}" --token $(gcloud auth print-identity-token) --xcresult-dir "/Users/runner/test/codecoverage" --log-link "https://github.com/firebase/firebase-ios-sdk/actions/runs/${GITHUB_RUN_ID}" --source-branch "${{ github.base_ref }}"
321+
cd scripts/code_coverage_report/generate_code_coverage_report
322+
swift run CoverageReportGenerator --merge "firebase/firebase-ios-sdk" --head-commit "${GITHUB_SHA}" --token $(gcloud auth print-identity-token) --xcresult-dir "/Users/runner/test/codecoverage" --log-link "https://github.com/firebase/firebase-ios-sdk/actions/runs/${GITHUB_RUN_ID}" --source-branch "${{ github.base_ref }}"
324323
fi

0 commit comments

Comments
 (0)