Skip to content

Commit 0d6e655

Browse files
committed
feat: add improvements
1 parent a651662 commit 0d6e655

File tree

3 files changed

+194
-44
lines changed

3 files changed

+194
-44
lines changed

.github/actions/use-arficats-from-specific-run/action.yaml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
platform:
1414
description: "Platform (android or ios)"
1515
required: true
16+
github_token:
17+
description: "GitHub token for authentication"
18+
required: true
1619
runs:
1720
using: "composite"
1821
steps:
@@ -31,16 +34,43 @@ runs:
3134
shell: bash
3235
run: |
3336
unset GITHUB_TOKEN
34-
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
37+
echo "${{ inputs.github_token }}" | gh auth login --with-token
3538
- name: "Fetch artifact URL"
3639
id: fetch-artifacts
3740
shell: bash
3841
run: |
39-
url=$(gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[] | select(.name == "${{ inputs.artifact_name }}") | .archive_download_url')
42+
echo "Fetching artifacts for run ID: ${{ inputs.run_id }}"
43+
echo "Looking for artifact: ${{ inputs.artifact_name }}"
44+
echo "Note: Use the full run ID from the URL (e.g., 17402124525), not the run number from the UI (e.g., #1269)"
45+
46+
# Check if the run exists
47+
if ! gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}" > /dev/null 2>&1; then
48+
echo "Error: Run ID ${{ inputs.run_id }} not found or not accessible"
49+
echo "Make sure you're using the full run ID from the URL, not the run number displayed in the UI"
50+
exit 1
51+
fi
52+
53+
# Get the artifact URL
54+
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 "")
55+
56+
if [ -z "$url" ]; then
57+
echo "Error: Artifact '${{ inputs.artifact_name }}' not found in run ${{ inputs.run_id }}"
58+
echo "Available artifacts in this run:"
59+
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"
60+
exit 1
61+
fi
62+
63+
echo "Found artifact URL: $url"
4064
echo "artifacts_url=$url" >> $GITHUB_ENV
4165
- name: "Download and extract artifact"
4266
if: env.artifacts_url != ''
4367
shell: bash
4468
run: |
45-
curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o ${{ inputs.platform }}-app.zip "$artifacts_url"
46-
unzip ${{ inputs.platform }}-app.zip -d ${{ inputs.output_dir }}
69+
echo "Downloading artifact from: $artifacts_url"
70+
curl -L -H "Authorization: token ${{ inputs.github_token }}" -o ${{ inputs.platform }}-app.zip "$artifacts_url"
71+
72+
echo "Extracting artifact to: ${{ inputs.output_dir }}"
73+
unzip ${{ inputs.platform }}-app.zip -d ${{ inputs.output_dir }}
74+
75+
echo "Contents of ${{ inputs.output_dir }}:"
76+
ls -la ${{ inputs.output_dir }}/

.github/scripts/determine-widget-scope.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ current_commit="$4"
1010
# List of all native widgets
1111
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"]'
1212

13+
# Combined widgets and JS actions for default cases
14+
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"]'
15+
1316
if [ "$event_name" == "pull_request" ]; then
1417
if git cat-file -e "$before_commit" 2>/dev/null; then
1518
changed_files=$(git diff --name-only "$before_commit" "$current_commit")
@@ -19,24 +22,42 @@ if [ "$event_name" == "pull_request" ]; then
1922
fi
2023

2124
selected_workspaces=""
25+
js_actions_changed=false
26+
2227
for file in $changed_files; do
2328
if [[ $file == packages/pluggableWidgets/* ]]; then
2429
widget=$(echo $file | cut -d'/' -f3)
2530
if [[ ! $selected_workspaces =~ $widget ]]; then
2631
selected_workspaces="$selected_workspaces $widget"
2732
fi
33+
elif [[ $file == packages/jsActions/mobile-resources-native/* ]] || [[ $file == packages/jsActions/nanoflow-actions-native/* ]]; then
34+
js_actions_changed=true
2835
fi
2936
done
3037

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

34-
if [[ -n "$selected_workspaces" ]]; then
41+
# Build the final scope and widgets output
42+
if [[ -n "$selected_workspaces" ]] && [[ "$js_actions_changed" == "true" ]]; then
43+
# Both widgets and JS actions changed
44+
# Convert space-separated widget names to JSON array format
45+
widget_array=$(echo "$selected_workspaces" | sed 's/ /","/g')
46+
echo "scope=--all --include '$selected_workspaces mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
47+
echo "widgets=[\"$widget_array\",\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
48+
elif [[ -n "$selected_workspaces" ]] && [[ "$js_actions_changed" == "false" ]]; then
49+
# Only widgets changed
50+
widget_array=$(echo "$selected_workspaces" | sed 's/ /","/g')
3551
echo "scope=--all --include '$selected_workspaces'" >> $GITHUB_OUTPUT
36-
echo "widgets=[\"$selected_workspaces\"]" >> $GITHUB_OUTPUT
52+
echo "widgets=[\"$widget_array\"]" >> $GITHUB_OUTPUT
53+
elif [[ -z "$selected_workspaces" ]] && [[ "$js_actions_changed" == "true" ]]; then
54+
# Only JS actions changed
55+
echo "scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
56+
echo "widgets=[\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
3757
else
38-
echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
39-
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT
58+
# No specific changes detected in widgets or JS actions, run everything
59+
echo "scope=--all --include '*-native mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
60+
echo "widgets=${all_widgets_and_js}" >> $GITHUB_OUTPUT
4061
fi
4162
else
4263
if [ -n "$input_workspace" ] && [ "$input_workspace" != "*-native" ] && [ "$input_workspace" != "js-actions" ]; then
@@ -47,8 +68,8 @@ else
4768
echo "scope=--all --include 'mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
4869
echo "widgets=[\"mobile-resources-native\",\"nanoflow-actions-native\"]" >> $GITHUB_OUTPUT
4970
else
50-
echo "scope=--all --include '*-native'" >> $GITHUB_OUTPUT
51-
echo "widgets=${all_widgets}" >> $GITHUB_OUTPUT
71+
echo "scope=--all --include '*-native mobile-resources-native nanoflow-actions-native'" >> $GITHUB_OUTPUT
72+
echo "widgets=${all_widgets_and_js}" >> $GITHUB_OUTPUT
5273
fi
5374
fi
5475

0 commit comments

Comments
 (0)