Skip to content

Commit c32d58d

Browse files
committed
Fix issues with action yml
Signed-off-by: Andy Doan <andy@foundries.io>
1 parent 80f39e4 commit c32d58d

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

.github/workflows/unit-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ jobs:
2121
with:
2222
path: ./build
2323
build_id: "${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}"
24+
github_token: "${{ secrets.GITHUB_TOKEN }}"

action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ inputs:
55
description: "Directory containing the files to upload"
66
required: true
77
build_id:
8-
description: "Path on fileserver to put artifacts under: ${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}"
8+
description: "Path on fileserver to put artifacts under: github.repository - github.run_id - github.run_attempt"
9+
required: true
10+
github_token:
11+
description: "The secrets.GITHUB_TOKEN variable in the workflow"
912
required: true
1013
fileserver_url:
1114
description: "Server to use for upload"
1215
required: true
13-
default: "https://quic-yocto-fileserver-1029608027416.us-central1.run.app'"
16+
default: "https://quic-yocto-fileserver-1029608027416.us-central1.run.app"
1417
upload_threads:
1518
description: "Number of concurrent upload threads to use"
1619
required: true
@@ -28,7 +31,10 @@ runs:
2831
BUILD_DIR: ${{ inputs.path }}
2932
BUILD_ID: ${{ inputs.build_id}}
3033
FILE_SERVER: ${{ inputs.fileserver_url }}
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
GITHUB_TOKEN: ${{ inputs.github_token }}
3235
UPLOAD_THREADS: ${{ inputs.upload_threads }}
3336
shell: bash
34-
run: ./publish_artifacts.py
37+
run: |
38+
set -ex
39+
python -m pip install requests
40+
python ${GITHUB_ACTION_PATH}/publish_artifacts.py

publish_artifacts.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def get_files_to_publish(path: str) -> List[str]:
8080

8181
def main(num_threads: int, artifacts_dir: str, base_url: str, output_file: str):
8282
paths = get_files_to_publish(artifacts_dir)
83-
print(f"= Found {len(paths)} files to publish", flush=True)
83+
print(f"= Found {len(paths)} files to publish to {base_url}", flush=True)
8484

8585
failed = False
8686
work = [(f"{base_url}{x}", artifacts_dir, x) for x in paths]
@@ -106,11 +106,11 @@ def main(num_threads: int, artifacts_dir: str, base_url: str, output_file: str):
106106
build_dir = build_dir + "/"
107107

108108
file_server = os.environ["FILE_SERVER"]
109-
if file_server[-1] != "/":
110-
file_server = file_server + "/"
109+
if file_server[-1] == "/":
110+
file_server = file_server[:-1]
111111

112112
build_id = os.environ["BUILD_ID"]
113-
url = f"{file_server}/${build_id}/"
113+
url = f"{file_server}/{build_id}/"
114114

115115
num_threads_str = os.environ.get("UPLOAD_THREADS", "5")
116116
num_threads = int(num_threads_str)

0 commit comments

Comments
 (0)