Skip to content

Commit 21730f3

Browse files
authored
Update workflow to exclude tests from external users. (#7539)
1 parent 8b01de9 commit 21730f3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.github/workflows/test_coverage.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
# closed will be triggered when a pull request is closed.
88
types: [opened, synchronize, closed]
99

10+
env:
11+
METRICS_SERVICE_SECRET: ${{ secrets.GHASecretsGPGPassphrase1 }}
12+
1013
jobs:
1114
check:
1215
if: github.repository == 'Firebase/firebase-ios-sdk' && (github.event.action == 'opened' || github.event.action == 'synchronize')
@@ -35,7 +38,10 @@ jobs:
3538
id: check_files
3639
env:
3740
pr_branch: ${{ github.event.pull_request.head.ref }}
38-
run: ./scripts/code_coverage_report/get_updated_files.sh
41+
run: |
42+
if [ ! -z "${{ env.METRICS_SERVICE_SECRET }}" ]; then
43+
./scripts/code_coverage_report/get_updated_files.sh
44+
fi
3945
4046
pod-lib-lint-database:
4147
needs: check
@@ -269,14 +275,12 @@ jobs:
269275

270276
create_report:
271277
needs: [check, pod-lib-lint-abtesting, pod-lib-lint-auth, pod-lib-lint-database, pod-lib-lint-dynamiclinks, pod-lib-lint-firestore, pod-lib-lint-functions, pod-lib-lint-inappmessaging, pod-lib-lint-instanceid, pod-lib-lint-messaging, pod-lib-lint-performance, pod-lib-lint-remoteconfig, pod-lib-lint-storage]
272-
env:
273-
metrics_service_secret: ${{ secrets.GHASecretsGPGPassphrase1 }}
274278
if: always()
275279
runs-on: macOS-latest
276280
steps:
277281
- uses: actions/checkout@v2
278282
- name: Access to Metrics Service
279-
if: env.metrics_service_secret
283+
if: ${{ env.METRICS_SERVICE_SECRET }}
280284
run: |
281285
# Install gcloud sdk
282286
curl https://sdk.cloud.google.com > install.sh
@@ -286,14 +290,14 @@ jobs:
286290
287291
# Activate the service account for Metrics Service.
288292
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/metrics_service_access.json.gpg \
289-
metrics-access.json "$metrics_service_secret"
293+
metrics-access.json "${{ env.METRICS_SERVICE_SECRET }}"
290294
gcloud auth activate-service-account --key-file metrics-access.json
291295
- uses: actions/download-artifact@v2
292296
id: download
293297
with:
294298
path: /Users/runner/test
295299
- name: Compare Diff and Post a Report
296-
if: github.event_name == 'pull_request' && env.metrics_service_secret
300+
if: github.event_name == 'pull_request' && ${{ env.METRICS_SERVICE_SECRET }}
297301
env:
298302
base_commit: ${{ needs.check.outputs.base_commit }}
299303
run: |
@@ -304,7 +308,7 @@ jobs:
304308
swift run CoverageReportGenerator --presubmit "firebase/firebase-ios-sdk" --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"
305309
fi
306310
- name: Update New Coverage Data
307-
if: github.event.pull_request.merged == true && env.metrics_service_secret
311+
if: github.event.pull_request.merged == true && ${{ env.METRICS_SERVICE_SECRET }}
308312
run: |
309313
if [ -d "${{steps.download.outputs.download-path}}" ]; then
310314
cd scripts/code_coverage_report/generate_code_coverage_report

0 commit comments

Comments
 (0)