feat: new parameter download-pattern to only download matching asset files #109
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
actions/forgejo-release!109
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fuse314/forgejo-release:feature/download-filter"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
closes #103
@ -38,6 +38,8 @@ inputs:download-latest:description: 'Download the latest release'default: falsedownload-filter:To match download-artifact, a better solution might be to do
pattern(globs) andname(single artifact)good point. Renamed parameter to
download-pattern.@ -19,6 +20,8 @@ if ${VERBOSE:-false}; then set -x; fi: ${RETRY:=1}: ${DELAY:=10}IFS=',' read -a DL_FILTER <<< "$DOWNLOAD_FILTER"<<<is not POSIX compliant, nor isread -a. iirc POSIX handles newlines in for loops, but if not, you can do a simple tr to fix that. Comma separation should be avoided since users will input as:pattern: pattern/1/* pattern2*Or:
@ -205,0 +216,4 @@fidonefireturn 1Please avoid arrays and
[[if possible.Amazing! I did not know that case implements pattern-matching!
So much simpler.
@ -218,3 +235,2 @@jq --raw-output '.assets[] | "\(.browser_download_url) \(.name)"' <"$TMP_DIR"/assets.json | while read url name; do # `name` may contain whitespace, therefore, it must be lasturl=$(echo "$url" | sed "s#/download/${TAG}/#/download/${TAG_URL}/#")curl --fail -H "Authorization: token $TOKEN" -o "$name" -L "$url"if maybe_download "$name" ; thenIf you use the previous function, we can just do
maybe_download "$name" "$url"@ -205,0 +223,4 @@for pattern in $DOWNLOAD_PATTERN; docase "$name" in$pattern)if [ $downloaded == 1 ]; then==is a ksh extension. Luckily, = does the same thing and is POSIX compliant 😁Btw, the downloaded thing may not even be necessary. You can just
returnwhen a download is called, and I don't think mentioning ignored files is actually necessary? or maybe it is. I say we leave that to the actual maintainers and not some random weirdo like me :Pfeat: new parameter download-filter to only download some asset filesto feat: new parameter download-pattern to only download matching asset filesView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.