Skip to content

Commit b39dff7

Browse files
Refactor Github Action per b/485167538
1 parent 2787ede commit b39dff7

File tree

7 files changed

+44
-17
lines changed

7 files changed

+44
-17
lines changed

.github/actions/notices_generation/action.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ runs:
3434
cd "${{ github.action_path }}"
3535
bundle install
3636
if ${{ inputs.search-local-pod-version == 'true' }} ; then
37-
ruby app.rb --pods ${{ inputs.pods }} --sources ${{ inputs.sources }} --min_ios_version ${{ inputs.min-ios-version }} --search_local_pod_version --notices_path ${{ inputs.notices-path }}
37+
ruby app.rb --pods ${INPUTS_PODS} --sources ${INPUTS_SOURCES} --min_ios_version ${INPUTS_MIN_IOS_VERSION} --search_local_pod_version --notices_path ${INPUTS_NOTICES_PATH}
3838
else
39-
ruby app.rb --pods ${{ inputs.pods }} --sources ${{ inputs.sources }} --min_ios_version ${{ inputs.min-ios-version }} --notices_path ${{ inputs.notices-path }}
39+
ruby app.rb --pods ${INPUTS_PODS} --sources ${INPUTS_SOURCES} --min_ios_version ${INPUTS_MIN_IOS_VERSION} --notices_path ${INPUTS_NOTICES_PATH}
4040
fi
4141
shell: bash
42+
env:
43+
INPUTS_PODS: ${{ inputs.pods }}
44+
INPUTS_SOURCES: ${{ inputs.sources }}
45+
INPUTS_MIN_IOS_VERSION: ${{ inputs.min-ios-version }}
46+
INPUTS_NOTICES_PATH: ${{ inputs.notices-path }}
4247
- name: Upload artifacts
4348
uses: actions/upload-artifact@v4
4449
with:

.github/workflows/api_diff_report.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,21 @@ jobs:
5353
- name: Generate API files for PR branch
5454
run: |
5555
python ~/api_diff_report/api_info.py \
56-
--file_list ${{ steps.get_changed_files.outputs.file_list }} \
56+
--file_list ${STEPS_GET_CHANGED_FILES_OUTPUTS_FILE_LIST} \
5757
--output_dir ${{ env.PR_API_OUTPUT }}
58+
env:
59+
STEPS_GET_CHANGED_FILES_OUTPUTS_FILE_LIST: ${{ steps.get_changed_files.outputs.file_list }}
5860

5961
- name: Checkout Base branch
6062
run: git checkout HEAD^
6163

6264
- name: Generate API files for Base branch
6365
run: |
6466
python ~/api_diff_report/api_info.py \
65-
--file_list ${{ steps.get_changed_files.outputs.file_list }} \
67+
--file_list ${STEPS_GET_CHANGED_FILES_OUTPUTS_FILE_LIST} \
6668
--output_dir ${{ env.BASE_API_OUTPUT }}
69+
env:
70+
STEPS_GET_CHANGED_FILES_OUTPUTS_FILE_LIST: ${{ steps.get_changed_files.outputs.file_list }}
6771

6872
- name: Generate API Diff Report
6973
run: |

.github/workflows/common_quickstart.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,18 @@ jobs:
8080
- name: Xcode
8181
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
8282
- name: Run setup command.
83-
run: ${{ inputs.setup_command }}
83+
run: ${INPUTS_SETUP_COMMAND}
84+
env:
85+
INPUTS_SETUP_COMMAND: ${{ inputs.setup_command }}
8486
- name: Install Secret GoogleService-Info.plist
8587
run: |
8688
scripts/decrypt_gha_secret.sh \
87-
${{ inputs.plist_src_path }} \
88-
${{ inputs.plist_dst_path }} \
89+
${INPUTS_PLIST_SRC_PATH} \
90+
${INPUTS_PLIST_DST_PATH} \
8991
"$plist_secret"
92+
env:
93+
INPUTS_PLIST_SRC_PATH: ${{ inputs.plist_src_path }}
94+
INPUTS_PLIST_DST_PATH: ${{ inputs.plist_dst_path }}
9095
- name: Build ${{ inputs.product }} Quickstart (${{ inputs.quickstart_type }} / ${{ inputs.is_legacy && 'Legacy' || 'Non-Legacy' }})
9196
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
9297
with:
@@ -102,11 +107,15 @@ jobs:
102107
- id: lowercase_product
103108
if: ${{ failure() }}
104109
run: |
105-
lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]')
110+
lowercase_product=$(echo "${INPUTS_PRODUCT}" | tr '[:upper:]' '[:lower:]')
106111
echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT
112+
env:
113+
INPUTS_PRODUCT: ${{ inputs.product }}
107114
- name: Remove data before upload.
108115
if: ${{ failure() }}
109-
run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }}
116+
run: scripts/remove_data.sh ${STEPS_LOWERCASE_PRODUCT_OUTPUTS_LOWERCASE_PRODUCT}
117+
env:
118+
STEPS_LOWERCASE_PRODUCT_OUTPUTS_LOWERCASE_PRODUCT: ${{ steps.lowercase_product.outputs.lowercase_product }}
110119
- uses: actions/upload-artifact@v4
111120
if: ${{ failure() }}
112121
with:

.github/workflows/health-metrics-presubmit.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
env:
5454
pr_branch: ${{ github.event.pull_request.head.ref }}
5555
run: |
56-
if [ ! -z "${{ env.METRICS_SERVICE_SECRET }}" ]; then
56+
if [ ! -z "${METRICS_SERVICE_SECRET}" ]; then
5757
./scripts/health_metrics/get_updated_files.sh
5858
fi
5959
@@ -312,7 +312,7 @@ jobs:
312312
313313
# Activate the service account for Metrics Service.
314314
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/metrics_service_access.json.gpg \
315-
metrics-access.json "${{ env.METRICS_SERVICE_SECRET }}"
315+
metrics-access.json "${METRICS_SERVICE_SECRET}"
316316
gcloud auth activate-service-account --key-file metrics-access.json
317317
- uses: actions/download-artifact@v4.1.7
318318
id: download
@@ -322,9 +322,10 @@ jobs:
322322
if: github.event.pull_request.merged != true && github.event.action != 'closed' && github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.base.ref == 'main'
323323
env:
324324
base_commit: ${{ needs.check.outputs.target_branch_head }}
325+
STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH: ${{steps.download.outputs.download-path}}
325326
run: |
326327
# Get Head commit of the branch, instead of a merge commit created by actions/checkout.
327-
if [ -d "${{steps.download.outputs.download-path}}" ]; then
328+
if [ -d "${STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH}" ]; then
328329
cd scripts/health_metrics/generate_code_coverage_report
329330
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"
330331
fi
@@ -357,7 +358,9 @@ jobs:
357358
- name: Update New Coverage Data
358359
if: github.event.pull_request.merged && github.event.pull_request.head.repo.full_name == github.repository
359360
run: |
360-
if [ -d "${{steps.download.outputs.download-path}}" ]; then
361+
if [ -d "${STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH}" ]; then
361362
cd scripts/health_metrics/generate_code_coverage_report
362-
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 }}"
363+
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}"
363364
fi
365+
env:
366+
STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH: ${{steps.download.outputs.download-path}}

.github/workflows/prerelease.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
git config --global user.name "google-oss-bot"
153153
- name: Update SpecsTesting repo
154154
run: |
155-
[[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
155+
[[ ${MATRIX_ALLOWWARNINGS} == true ]] && ALLOWWARNINGS=true
156156
cd scripts/create_spec_repo/
157157
swift build
158158
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
@@ -166,6 +166,8 @@ jobs:
166166
--pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
167167
--include-pods "${targeted_pod}" \
168168
--keep-repo ${ALLOWWARNINGS:+--allow-warnings}
169+
env:
170+
MATRIX_ALLOWWARNINGS: ${{ matrix.allowwarnings }}
169171
- name: Clean Artifacts
170172
if: ${{ always() }}
171173
run: pod repo remove "${local_repo}"

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
git config --global user.name "google-oss-bot"
138138
- name: Update SpecsReleasing repo
139139
run: |
140-
[[ ${{ matrix.allowwarnings }} == true ]] && ALLOWWARNINGS=true
140+
[[ ${MATRIX_ALLOWWARNINGS} == true ]] && ALLOWWARNINGS=true
141141
cd scripts/create_spec_repo/
142142
swift build
143143
pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsReleasing.git
@@ -149,6 +149,8 @@ jobs:
149149
--pod-sources 'https://github.com/Firebase/SpecsReleasing' "https://github.com/firebase/SpecsStaging.git" "https://github.com/CocoaPods/Specs.git" \
150150
--include-pods "${targeted_pod}" \
151151
--keep-repo ${ALLOWWARNINGS:+--allow-warnings}
152+
env:
153+
MATRIX_ALLOWWARNINGS: ${{ matrix.allowwarnings }}
152154
- name: Clean Artifacts
153155
if: ${{ always() }}
154156
run: pod repo remove "${local_repo}"

.github/workflows/update-cpp-sdk-on-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,6 @@ jobs:
8282
- name: Trigger firebase-cpp-sdk update
8383
run: |
8484
pip install -r scripts/gha/python_requirements.txt
85-
python scripts/gha/trigger_workflow.py -t ${{ steps.generate-token.outputs.token }} -w update-dependencies.yml -p updateAndroid 0 -p updateiOS 1 -p comment "[Triggered]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) by [firebase-ios-sdk $GITHUB_REF release]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$GITHUB_REF)." -s 10 -A
85+
python scripts/gha/trigger_workflow.py -t ${STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN} -w update-dependencies.yml -p updateAndroid 0 -p updateiOS 1 -p comment "[Triggered]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID) by [firebase-ios-sdk $GITHUB_REF release]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$GITHUB_REF)." -s 10 -A
86+
env:
87+
STEPS_GENERATE_TOKEN_OUTPUTS_TOKEN: ${{ steps.generate-token.outputs.token }}

0 commit comments

Comments
 (0)