Skip to content

Commit c3d7764

Browse files
committed
Fix download artifact from GitHub
1 parent 2e1f3fa commit c3d7764

File tree

1 file changed

+27
-4
lines changed
  • .github/actions/opendaq-github-download-artifact

1 file changed

+27
-4
lines changed

.github/actions/opendaq-github-download-artifact/action.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,37 @@ runs:
2020
run: |
2121
DEST="${{ inputs.destination-dir }}"
2222
DEST=$(echo "$DEST" | sed 's|\\|/|g')
23+
RUN_ID="${{ inputs.opendaq-artifact-run-id }}"
2324
2425
ARTIFACT_NAME="${{ inputs.opendaq-artifact-name }}"
2526
ARTIFACT_DIR="$DEST/$ARTIFACT_NAME"
2627
27-
gh run download "${{ inputs.opendaq-artifact-run-id }}" \
28-
--repo openDAQ/openDAQ \
29-
--pattern "$ARTIFACT_NAME" \
30-
--dir "$DEST"
28+
echo "ARTIFACT_DIR=$ARTIFACT_DIR"
29+
echo "ARTIFACT_NAME=$ARTIFACT_NAME"
30+
echo "RUN_ID=$RUN_ID"
31+
32+
REPO="openDAQ/openDAQ"
33+
34+
35+
URL=$(gh api repos/$REPO/actions/runs/$RUN_ID/artifacts \
36+
--jq ".artifacts[] | select(.name==\"$ARTIFACT_NAME\") | .archive_download_url")
37+
38+
echo "URL to download: '$url'"
39+
if [ -z "$URL" ]; then
40+
echo "❌ Artifact '$ARTIFACT_NAME' not found in run $RUN_ID"
41+
exit 1
42+
fi
43+
44+
ZIP_PATH="$DEST/$ARTIFACT_NAME.zip"
45+
gh api "$URL" --output "$ZIP_PATH"
46+
47+
echo "📦 Downloaded $ZIP_PATH"
48+
unzip -o "$ZIP_PATH" -d "$DEST/$ARTIFACT_NAME"
49+
50+
# gh run download ${{ inputs.opendaq-artifact-run-id }} \
51+
# --repo openDAQ/openDAQ \
52+
# --name $ARTIFACT_NAME \
53+
# --dir "$DEST"
3154
3255
echo "$ARTIFACT_DIR/"
3356
ls -la "$ARTIFACT_DIR/"

0 commit comments

Comments
 (0)