Skip to content

Commit d8faf57

Browse files
committed
ci: widen the net when downloading artifacts
1 parent 1dc1e9f commit d8faf57

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

.github/workflows/release-drafter.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,28 +253,40 @@ jobs:
253253
- name: Download all release artifacts
254254
run: |
255255
TAG="${{ needs.check-tag.outputs.tag_name }}"
256-
257-
# Get the actual commit SHA to ensure we are looking at the right point in history
258256
COMMIT_SHA=$(git rev-parse "${TAG}^{commit}")
259257
echo "Tag $TAG points to commit: $COMMIT_SHA"
260258
261-
# Filter for the latest successful run of each unique workflow for this commit
262-
WORKFLOW_RUNS=$(gh run list --commit "$COMMIT_SHA" --status success --json workflowName,databaseId,createdAt --jq 'sort_by(.createdAt) | reverse | unique_by(.workflowName) | .[].databaseId')
259+
# Get the latest successful run ID for each unique workflow name
260+
WORKFLOW_RUNS=$(gh run list --commit "$COMMIT_SHA" --status success --json workflowName,databaseId,createdAt --jq 'group_by(.workflowName) | map(sort_by(.createdAt) | last) | .[].databaseId')
263261
264262
if [ -z "$WORKFLOW_RUNS" ]; then
265263
echo "No successful workflow runs found for commit $COMMIT_SHA"
266264
exit 1
267265
fi
268266
269267
mkdir -p release-assets
268+
270269
for run_id in $WORKFLOW_RUNS; do
271-
echo "Downloading artifacts from run $run_id..."
272-
gh run download $run_id --dir release-assets --pattern "edgetx-*-${TAG}" --clobber 2>/dev/null || echo "No matching artifacts in run $run_id"
270+
echo "Processing Run ID: $run_id"
271+
272+
# Download EVERYTHING from this run into a subfolder
273+
# This avoids the "pattern" matching issue entirely
274+
mkdir -p "temp_$run_id"
275+
if gh run download "$run_id" --dir "temp_$run_id"; then
276+
# Now, move only the files we actually want into release-assets
277+
# We use find to look for anything starting with 'edgetx'
278+
find "temp_$run_id" -type f \( -name "edgetx*" -o -name "companion*" \) -exec cp -n {} release-assets/ \;
279+
echo "Finished processing run $run_id"
280+
fi
281+
rm -rf "temp_$run_id"
273282
done
274283
275-
# Check if we got any artifacts
284+
# List what we found for debugging
285+
echo "Files collected in release-assets:"
286+
ls -R release-assets
287+
276288
if [ ! "$(ls -A release-assets 2>/dev/null)" ]; then
277-
echo "::error::No artifacts found matching pattern edgetx-*-${TAG}"
289+
echo "::error::No artifacts found in any of the successful runs for this commit."
278290
exit 1
279291
fi
280292
env:

0 commit comments

Comments
 (0)