Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix validation workflow to download draft release assets using GitHub API

rcourtman441eec8b0f14
diff --git a/.github/workflows/validate-release-assets.yml b/.github/workflows/validate-release-assets.yml
index c4a8f4211c..9e314f1b43 100644
--- a/.github/workflows/validate-release-assets.yml
+++ b/.github/workflows/validate-release-assets.yml
@@ -115,37 +115,41 @@ jobs:
- name: Download all release assets
if: steps.context.outputs.should_run == 'true'
id: download
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Downloading all assets from release ${{ steps.context.outputs.tag }}..."
mkdir -p release
cd release
- ASSETS=$(gh api "repos/${{ github.repository }}/releases/${{ steps.context.outputs.release_id }}/assets" --jq '.[].browser_download_url')
+ # Get asset info (id and name) - API works with GITHUB_TOKEN for draft releases
+ ASSETS_JSON=$(gh api "repos/${{ github.repository }}/releases/${{ steps.context.outputs.release_id }}/assets")
- if [ -z "$ASSETS" ]; then
+ if [ "$(echo "$ASSETS_JSON" | jq '. | length')" -eq 0 ]; then
echo "::error::No assets found in release"
echo "has_assets=false" >> $GITHUB_OUTPUT
exit 1
fi
echo "has_assets=true" >> $GITHUB_OUTPUT
- echo "Found assets:"
- echo "$ASSETS"
-
- echo "$ASSETS" | while read -r url; do
- if [ -n "$url" ]; then
- filename=$(basename "$url")
- echo "Downloading $filename..."
- gh release download "${{ steps.context.outputs.tag }}" \
- --pattern "$filename" --dir . --clobber
-
- if [ $? -eq 0 ]; then
- echo "✓ Downloaded $filename ($(du -h "$filename" | cut -f1))"
- else
- echo "::error::Failed to download $filename"
- exit 1
- fi
+ echo "Found $(echo "$ASSETS_JSON" | jq '. | length') assets"
+
+ # Download each asset using the API (works with draft releases)
+ echo "$ASSETS_JSON" | jq -r '.[] | "\(.id) \(.name)"' | while read -r asset_id filename; do
+ echo "Downloading $filename (ID: $asset_id)..."
+
+ # Use GitHub API to download with authentication
+ curl -L -H "Authorization: token $GH_TOKEN" \
+ -H "Accept: application/octet-stream" \
+ "https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id" \
+ -o "$filename"
+
+ if [ $? -eq 0 ] && [ -f "$filename" ]; then
+ echo "✓ Downloaded $filename ($(du -h "$filename" | cut -f1))"
+ else
+ echo "::error::Failed to download $filename"
+ exit 1
fi
done