Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions .github/workflows/publishReactNativeArtifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ on:
- patches/react-native/@react-native+*.patch
- Mobile-Expensify
- scripts/artifacts-utils/compute-patches-hash.sh
# Keep in sync with the "Check if artifact publishing workflows changed" step below.
- .github/workflows/publishReactNativeArtifacts.yml
- .github/workflows/publishReactNativeiOSArtifacts.yml
- .github/workflows/publishReactNativeAndroidArtifacts.yml
- .github/actions/composite/fetchReactNativePrebuild/action.yml
- scripts/artifacts-utils/ios/publish/**

jobs:
verifyPatches:
Expand Down Expand Up @@ -117,6 +123,24 @@ jobs:
echo "::notice::Detected changes in Standalone NewDot patches (${{ steps.getOldPatchesHash.outputs.STANDALONE_APP_HASH }} -> ${{ steps.getNewPatchesHash.outputs.STANDALONE_APP_HASH }})"
fi

- name: Check if artifact publishing workflows changed
if: ${{ github.event.after != '' }}
id: didWorkflowsChange
run: |
# Edits to the publishing workflows, the prebuild fetch action, or the iOS publish Gradle project
# change how artifacts are built without touching patches or the RN version. Keep in sync with `on.push.paths`.
if git diff --quiet '${{ github.event.before }}' '${{ github.event.after }}' -- \
.github/workflows/publishReactNativeArtifacts.yml \
.github/workflows/publishReactNativeiOSArtifacts.yml \
.github/workflows/publishReactNativeAndroidArtifacts.yml \
.github/actions/composite/fetchReactNativePrebuild/action.yml \
scripts/artifacts-utils/ios/publish; then
echo "DID_WORKFLOWS_CHANGE=false" >> "$GITHUB_OUTPUT"
else
echo "DID_WORKFLOWS_CHANGE=true" >> "$GITHUB_OUTPUT"
echo "::notice::Detected changes in the artifact publishing workflows"
Comment on lines +126 to +141

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didWorkflowsChange no longer matches its scope

The step now also checks fetchReactNativePrebuild/action.yml and the iOS publish Gradle project, but its name, id and output still say "workflows". Line 167 then logs "a change to the publishing workflows" when the trigger was the Gradle project.

Rename to something like didPublishPipelineChange / DID_PUBLISH_PIPELINE_CHANGE, and update the reference in the comment at line 44.

Comment on lines +132 to +141

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A git diff error is treated as a change

git diff --quiet exits 128 on failure, e.g. a missing commit. Inside an if, bash -e doesn't apply, so the error falls into the else branch.

Expected: the step fails with the git error.
Actual: it logs "Detected changes in the artifact publishing workflows" and starts a full rebuild of all four jobs.

Suggested Fix: capture the exit code and fail when it's above 1.

fi

- name: Get artifact build targets
id: getArtifactBuildTargets
run: |
Expand All @@ -139,8 +163,8 @@ jobs:
fi

# push path: derive targets from what actually changed between github.event.before and github.event.after.
# Version change or standalone patch change forces a full rebuild of both hybrid and standalone.
if [[ '${{ steps.didVersionChange.outputs.DID_VERSION_CHANGE }}' == 'true' || '${{ steps.didPatchesChange.outputs.DID_STANDALONE_APP_PATCHES_CHANGE }}' == 'true' ]]; then
# Version change, standalone patch change or a change to the publishing workflows forces a full rebuild of both hybrid and standalone.
if [[ '${{ steps.didVersionChange.outputs.DID_VERSION_CHANGE }}' == 'true' || '${{ steps.didPatchesChange.outputs.DID_STANDALONE_APP_PATCHES_CHANGE }}' == 'true' || '${{ steps.didWorkflowsChange.outputs.DID_WORKFLOWS_CHANGE }}' == 'true' ]]; then
echo "BUILD_TARGETS=[\"true\", \"false\"]" >> "$GITHUB_OUTPUT"
elif [[ '${{ steps.didPatchesChange.outputs.DID_HYBRID_APP_PATCHES_CHANGE }}' == 'true' ]]; then
echo "BUILD_TARGETS=[\"true\"]" >> "$GITHUB_OUTPUT"
Expand Down
Loading