Skip to content
Merged
Show file tree
Hide file tree
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
38 changes: 34 additions & 4 deletions .github/actions/use-arficats-from-specific-run/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
platform:
description: "Platform (android or ios)"
required: true
github_token:
description: "GitHub token for authentication"
required: true
runs:
using: "composite"
steps:
Expand All @@ -31,16 +34,43 @@ runs:
shell: bash
run: |
unset GITHUB_TOKEN
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
echo "${{ inputs.github_token }}" | gh auth login --with-token
- name: "Fetch artifact URL"
id: fetch-artifacts
shell: bash
run: |
url=$(gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[] | select(.name == "${{ inputs.artifact_name }}") | .archive_download_url')
echo "Fetching artifacts for run ID: ${{ inputs.run_id }}"
echo "Looking for artifact: ${{ inputs.artifact_name }}"
echo "Note: Use the full run ID from the URL (e.g., 17402124525), not the run number from the UI (e.g., #1269)"

# Check if the run exists
if ! gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}" > /dev/null 2>&1; then
echo "Error: Run ID ${{ inputs.run_id }} not found or not accessible"
echo "Make sure you're using the full run ID from the URL, not the run number displayed in the UI"
exit 1
fi

# Get the artifact URL
url=$(gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[] | select(.name == "${{ inputs.artifact_name }}") | .archive_download_url' 2>/dev/null || echo "")

if [ -z "$url" ]; then
echo "Error: Artifact '${{ inputs.artifact_name }}' not found in run ${{ inputs.run_id }}"
echo "Available artifacts in this run:"
gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[].name' 2>/dev/null || echo "No artifacts found or run not accessible"
exit 1
fi

echo "Found artifact URL: $url"
echo "artifacts_url=$url" >> $GITHUB_ENV
- name: "Download and extract artifact"
if: env.artifacts_url != ''
shell: bash
run: |
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o ${{ inputs.platform }}-app.zip "$artifacts_url"
unzip ${{ inputs.platform }}-app.zip -d ${{ inputs.output_dir }}
echo "Downloading artifact from: $artifacts_url"
curl -L -H "Authorization: token ${{ inputs.github_token }}" -o ${{ inputs.platform }}-app.zip "$artifacts_url"

echo "Extracting artifact to: ${{ inputs.output_dir }}"
unzip ${{ inputs.platform }}-app.zip -d ${{ inputs.output_dir }}

echo "Contents of ${{ inputs.output_dir }}:"
ls -la ${{ inputs.output_dir }}/
33 changes: 27 additions & 6 deletions .github/scripts/determine-widget-scope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ current_commit="$4"
# List of all native widgets
all_widgets='["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native"]'

# Combined widgets and JS actions for default cases
all_widgets_and_js='["accordion-native","activity-indicator-native","animation-native","app-events-native","background-gradient-native","background-image-native","badge-native","bar-chart-native","barcode-scanner-native","bottom-sheet-native","carousel-native","color-picker-native","column-chart-native","feedback-native","floating-action-button-native","gallery-native","gallery-text-filter-native","image-native","intro-screen-native","line-chart-native","listview-swipe-native","maps-native","pie-doughnut-chart-native","popup-menu-native","progress-bar-native","progress-circle-native","qr-code-native","radio-buttons-native","range-slider-native","rating-native","repeater-native","safe-area-view-native","signature-native","slider-native","switch-native","toggle-buttons-native","video-player-native","web-view-native","mobile-resources-native","nanoflow-actions-native"]'

if [ "$event_name" == "pull_request" ]; then
if git cat-file -e "$before_commit" 2>/dev/null; then
changed_files=$(git diff --name-only "$before_commit" "$current_commit")
Expand All @@ -19,24 +22,42 @@ if [ "$event_name" == "pull_request" ]; then
fi

selected_workspaces=""
js_actions_changed=false

for file in $changed_files; do
if [[ $file == packages/pluggableWidgets/* ]]; then
widget=$(echo $file | cut -d'/' -f3)
if [[ ! $selected_workspaces =~ $widget ]]; then
selected_workspaces="$selected_workspaces $widget"
fi
elif [[ $file == packages/jsActions/mobile-resources-native/* ]] || [[ $file == packages/jsActions/nanoflow-actions-native/* ]]; then
js_actions_changed=true
fi
done

# Trim leading and trailing spaces from selected_workspaces
selected_workspaces=$(echo $selected_workspaces | xargs)

if [[ -n "$selected_workspaces" ]]; then
# Build the final scope and widgets output
if [[ -n "$selected_workspaces" ]] && [[ "$js_actions_changed" == "true" ]]; then
# Both widgets and JS actions changed
# Convert space-separated widget names to JSON array format
widget_array=$(echo "$selected_workspaces" | sed 's/ /","/g')
echo "scope=--all --include '$selected_workspaces mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
echo "widgets=[\"$widget_array\",\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
elif [[ -n "$selected_workspaces" ]] && [[ "$js_actions_changed" == "false" ]]; then
# Only widgets changed
widget_array=$(echo "$selected_workspaces" | sed 's/ /","/g')
echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT
echo "widgets=[\"$widget_array\"]" >> $GITHUB_OUTPUT
elif [[ -z "$selected_workspaces" ]] && [[ "$js_actions_changed" == "true" ]]; then
# Only JS actions changed
echo "scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
echo "widgets=[\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
else
echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT
# No specific changes detected in widgets or JS actions, run everything
echo "scope=--all --include '*-native mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
echo "widgets=${all_widgets_and_js}" >> $GITHUB_OUTPUT
fi
else
if [ -n "$input_workspace" ] && [ "$input_workspace" != "*-native" ] && [ "$input_workspace" != "js-actions" ]; then
Expand All @@ -47,8 +68,8 @@ else
echo "scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
echo "widgets=[\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
else
echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT
echo "scope=--all --include '*-native mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
echo "widgets=${all_widgets_and_js}" >> $GITHUB_OUTPUT
fi
fi

Expand Down
Loading
Loading