Skip to content

Commit 5e2e0f3

Browse files
Refactor Github Action per b/485167538
1 parent 4b22835 commit 5e2e0f3

File tree

8 files changed

+51
-20
lines changed

8 files changed

+51
-20
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@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
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
@@ -78,13 +78,18 @@ jobs:
7878
- name: Xcode
7979
run: sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
8080
- name: Run setup command.
81-
run: ${{ inputs.setup_command }}
81+
run: ${INPUTS_SETUP_COMMAND}
82+
env:
83+
INPUTS_SETUP_COMMAND: ${{ inputs.setup_command }}
8284
- name: Install Secret GoogleService-Info.plist
8385
run: |
8486
scripts/decrypt_gha_secret.sh \
85-
${{ inputs.plist_src_path }} \
86-
${{ inputs.plist_dst_path }} \
87+
${INPUTS_PLIST_SRC_PATH} \
88+
${INPUTS_PLIST_DST_PATH} \
8789
"$plist_secret"
90+
env:
91+
INPUTS_PLIST_SRC_PATH: ${{ inputs.plist_src_path }}
92+
INPUTS_PLIST_DST_PATH: ${{ inputs.plist_dst_path }}
8893
- name: Build ${{ inputs.product }} Quickstart
8994
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
9095
with:
@@ -99,11 +104,15 @@ jobs:
99104
- id: lowercase_product
100105
if: failure()
101106
run: |
102-
lowercase_product=$(echo "${{ inputs.product }}" | tr '[:upper:]' '[:lower:]')
107+
lowercase_product=$(echo "${INPUTS_PRODUCT}" | tr '[:upper:]' '[:lower:]')
103108
echo "lowercase_product=$lowercase_product" >> $GITHUB_OUTPUT
109+
env:
110+
INPUTS_PRODUCT: ${{ inputs.product }}
104111
- name: Remove data before upload.
105112
if: failure()
106-
run: scripts/remove_data.sh ${{ steps.lowercase_product.outputs.lowercase_product }}
113+
run: scripts/remove_data.sh ${STEPS_LOWERCASE_PRODUCT_OUTPUTS_LOWERCASE_PRODUCT}
114+
env:
115+
STEPS_LOWERCASE_PRODUCT_OUTPUTS_LOWERCASE_PRODUCT: ${{ steps.lowercase_product.outputs.lowercase_product }}
107116
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
108117
if: failure()
109118
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
@@ -284,7 +284,7 @@ jobs:
284284
285285
# Activate the service account for Metrics Service.
286286
scripts/decrypt_gha_secret.sh scripts/gha-encrypted/metrics_service_access.json.gpg \
287-
metrics-access.json "${{ env.METRICS_SERVICE_SECRET }}"
287+
metrics-access.json "${METRICS_SERVICE_SECRET}"
288288
gcloud auth activate-service-account --key-file metrics-access.json
289289
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
290290
id: download
@@ -294,9 +294,10 @@ jobs:
294294
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'
295295
env:
296296
base_commit: ${{ needs.check.outputs.target_branch_head }}
297+
STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH: ${{steps.download.outputs.download-path}}
297298
run: |
298299
# Get Head commit of the branch, instead of a merge commit created by actions/checkout.
299-
if [ -d "${{steps.download.outputs.download-path}}" ]; then
300+
if [ -d "${STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH}" ]; then
300301
cd scripts/health_metrics/generate_code_coverage_report
301302
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"
302303
fi
@@ -329,7 +330,9 @@ jobs:
329330
- name: Update New Coverage Data
330331
if: github.event.pull_request.merged && github.event.pull_request.head.repo.full_name == github.repository
331332
run: |
332-
if [ -d "${{steps.download.outputs.download-path}}" ]; then
333+
if [ -d "${STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH}" ]; then
333334
cd scripts/health_metrics/generate_code_coverage_report
334-
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 }}"
335+
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}"
335336
fi
337+
env:
338+
STEPS_DOWNLOAD_OUTPUTS_DOWNLOAD_PATH: ${{steps.download.outputs.download-path}}

.github/workflows/prerelease_cocoapods.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_cocoapods.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 }}

.github/workflows/zip.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,13 @@ jobs:
6565
- name: Check if packaging should be skipped
6666
id: check
6767
run: |
68-
if [[ -n "${{ env.PINNED_RUN_ID }}" || -n "${{ github.event.inputs.zip_run_id }}" ]]; then
68+
if [[ -n "${{ env.PINNED_RUN_ID }}" || -n "${GITHUB_EVENT_INPUTS_ZIP_RUN_ID}" ]]; then
6969
echo "should_package=false" >> $GITHUB_OUTPUT
7070
else
7171
echo "should_package=true" >> $GITHUB_OUTPUT
7272
fi
73+
env:
74+
GITHUB_EVENT_INPUTS_ZIP_RUN_ID: ${{ github.event.inputs.zip_run_id }}
7375

7476
package-release:
7577
needs: should_package
@@ -161,13 +163,15 @@ jobs:
161163
- name: Get Run ID
162164
id: get_run_id
163165
run: |
164-
if [[ -n "${{ github.event.inputs.zip_run_id }}" ]]; then
165-
echo "run_id=${{ github.event.inputs.zip_run_id }}" >> $GITHUB_OUTPUT
166+
if [[ -n "${GITHUB_EVENT_INPUTS_ZIP_RUN_ID}" ]]; then
167+
echo "run_id=${GITHUB_EVENT_INPUTS_ZIP_RUN_ID}" >> $GITHUB_OUTPUT
166168
elif [[ -n "${{ env.PINNED_RUN_ID }}" ]]; then
167169
echo "run_id=${{ env.PINNED_RUN_ID }}" >> $GITHUB_OUTPUT
168170
else
169171
echo "run_id=${{ github.run_id }}" >> $GITHUB_OUTPUT
170172
fi
173+
env:
174+
GITHUB_EVENT_INPUTS_ZIP_RUN_ID: ${{ github.event.inputs.zip_run_id }}
171175

172176
check_framework_firestore_symbols:
173177
needs: packaging_done

0 commit comments

Comments
 (0)