Skip to content

Commit 206a1a8

Browse files
committed
Move not used code into separate action
1 parent 0c706e2 commit 206a1a8

4 files changed

Lines changed: 70 additions & 60 deletions

File tree

.github/actions/setup-python/action.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ runs:
66
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
77
with:
88
python-version: '3.x'
9-
cache: 'pip'
109
- run: pip install PyYAML httplib2
1110
shell: bash

.github/actions/setup-tools/action.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ runs:
1313
steps:
1414
- name: "Setup Python and dependencies"
1515
uses: ./.github/actions/setup-python
16-
- name: "Cache pip"
17-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 #v4
18-
with:
19-
path: ~/.cache/pip
20-
key: ${{ runner.os }}-pip-pyaml-httplib2
2116

2217
- name: "Setup Node and dependencies"
2318
uses: ./.github/actions/setup-node-with-cache
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Download Artifact from Specific Run"
2+
description: "Download an artifact from a specific workflow run using GitHub CLI"
3+
inputs:
4+
artifact_name:
5+
description: "Name of the artifact to download"
6+
required: true
7+
run_id:
8+
description: "Workflow run ID"
9+
required: true
10+
output_dir:
11+
description: "Directory to extract the artifact"
12+
required: true
13+
platform:
14+
description: "Platform (android or ios)"
15+
required: true
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: "Install GitHub CLI"
20+
shell: bash
21+
run: |
22+
if ! command -v gh &> /dev/null; then
23+
if [[ "$RUNNER_OS" == "Linux" ]]; then
24+
sudo apt update
25+
sudo apt install -y gh
26+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
27+
brew install gh
28+
fi
29+
fi
30+
- name: "Authenticate GitHub CLI"
31+
shell: bash
32+
run: |
33+
unset GITHUB_TOKEN
34+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
35+
- name: "Fetch artifact URL"
36+
id: fetch-artifacts
37+
shell: bash
38+
run: |
39+
url=$(gh api "repos/${{ github.repository }}/actions/runs/${{ inputs.run_id }}/artifacts" --jq '.artifacts[] | select(.name == "${{ inputs.artifact_name }}") | .archive_download_url')
40+
echo "artifacts_url=$url" >> $GITHUB_ENV
41+
- name: "Download and extract artifact"
42+
if: env.artifacts_url != ''
43+
shell: bash
44+
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 }}

.github/workflows/NativePipeline.yml

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
default: ""
1616
required: false
1717
type: string
18+
LOCAL_TEST_ARTIFACT_RUN_ID:
19+
description: "Workflow run ID for local artifact download (leave empty for normal CI)"
20+
required: false
21+
default: ""
1822
workspace:
1923
description: "Select a widget to test (Default will run all)"
2024
required: true
@@ -70,6 +74,8 @@ on:
7074

7175
# Use default name in case no input
7276
run-name: ${{ github.event.inputs.run_name || 'Run Native Pipeline' }}
77+
env:
78+
LOCAL_TEST_ARTIFACT_RUN_ID: ${{ github.event.inputs.LOCAL_TEST_ARTIFACT_RUN_ID || '' }}
7379
permissions:
7480
packages: write
7581
jobs:
@@ -485,35 +491,15 @@ jobs:
485491
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
486492
with:
487493
name: mda
488-
489-
# USED ONLY FOR TESTING PURPOSE - TO SKIP APP BUILD PART AND DOWNLOAD FROM SPECIFIC RUN
490-
# - name: "Install GitHub CLI"
491-
# run: |
492-
# curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
493-
# sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
494-
# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
495-
# sudo apt update
496-
# sudo apt install gh
497-
# - name: "Authenticate GitHub CLI"
498-
# run: |
499-
# unset GITHUB_TOKEN
500-
# echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
501-
# - name: "Fetch artifacts from run 676"
502-
# id: fetch-artifacts
503-
# run: |
504-
# artifacts_url=$(gh api "repos/${{ github.repository }}/actions/runs/13453887084/artifacts" --jq '.artifacts[] | select(.name == "android-app") | .archive_download_url')
505-
# echo "Artifacts URL: $artifacts_url"
506-
# echo "artifacts_url=$artifacts_url" >> $GITHUB_ENV
507-
# - name: "Download Android app"
508-
# if: env.artifacts_url != ''
509-
# run: |
510-
# if [ -z "$artifacts_url" ]; then
511-
# echo "No artifacts URL found."
512-
# exit 1
513-
# fi
514-
# curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o android-app.zip "$artifacts_url"
515-
# unzip android-app.zip -d android-app
516-
494+
# Used only for local testing, will be empty on GitHub
495+
- name: "Download Android app from specific run"
496+
if: ${{ env.LOCAL_TEST_ARTIFACT_RUN_ID != '' }}
497+
uses: ./.github/actions/use-arficats-from-specific-run
498+
with:
499+
artifact_name: android-app
500+
run_id: ${{ env.LOCAL_TEST_ARTIFACT_RUN_ID }}
501+
output_dir: android-app
502+
platform: android
517503
- name: "Download Android app"
518504
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
519505
with:
@@ -594,31 +580,15 @@ jobs:
594580
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
595581
with:
596582
name: mda
597-
598-
# USED ONLY FOR TESTING PURPOSE - TO SKIP APP BUILD PART AND DOWNLOAD APP FROM SPECIFIC RUN
599-
# - name: "Install GitHub CLI"
600-
# run: |
601-
# brew install gh
602-
# - name: "Authenticate GitHub CLI"
603-
# run: |
604-
# unset GITHUB_TOKEN
605-
# echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
606-
# - name: "Fetch artifacts from run 676"
607-
# id: fetch-artifacts
608-
# run: |
609-
# artifacts_url=$(gh api "repos/${{ github.repository }}/actions/runs/13453887084/artifacts" --jq '.artifacts[] | select(.name == "ios-app") | .archive_download_url')
610-
# echo "Artifacts URL: $artifacts_url"
611-
# echo "artifacts_url=$artifacts_url" >> $GITHUB_ENV
612-
# - name: "Download iOS app"
613-
# if: env.artifacts_url != ''
614-
# run: |
615-
# if [ -z "$artifacts_url" ]; then
616-
# echo "No artifacts URL found."
617-
# exit 1
618-
# fi
619-
# curl -L -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -o ios-app.zip "$artifacts_url"
620-
# unzip ios-app.zip -d ios-app
621-
583+
# Used only for local testing, will be empty on GitHub
584+
- name: "Download iOS app from specific run"
585+
if: ${{ env.LOCAL_TEST_ARTIFACT_RUN_ID != '' }}
586+
uses: ./.github/actions/use-arficats-from-specific-run
587+
with:
588+
artifact_name: ios-app
589+
run_id: ${{ env.LOCAL_TEST_ARTIFACT_RUN_ID }}
590+
output_dir: ios-app
591+
platform: ios
622592
- name: "Download iOS app"
623593
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
624594
with:

0 commit comments

Comments
 (0)