Add ignoreTags support to exclude old versions from packaging (#118)
* Add ignoreTags support to exclude old versions from packaging Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> * Add ignoreTags support to add-action and update-action scripts Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> * Fix JSDoc typo and add regex validation for ignore-tags patterns Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> * Simplify --ignore-tags to accept version prefixes instead of regex patterns Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> * Add helper script to add ignoreTags to existing actions and fix JSON syntax in README Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> * Remove --all flag from add-ignore-tags.sh, require specific action Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TingluoHuang <1750815+TingluoHuang@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,10 @@ for json_file in $script_dir/../../config/actions/*.json; do
|
||||
curl_download_commands+=("curl -s -S -L -o '$sha.zip' 'https://api.github.com/repos/$owner/$repo/zipball/$sha'")
|
||||
done
|
||||
|
||||
# Get an array of ignoreTags patterns (if present)
|
||||
ignore_patterns=()
|
||||
IFS=$'\n' read -r -d '' -a ignore_patterns < <( echo "$json" | jq --raw-output '.ignoreTags // [] | .[]' && printf '\0' )
|
||||
|
||||
# Get an array of tag info. Each item contains "<tag> <commit_sha>"
|
||||
tag_info=()
|
||||
IFS=$'\n' read -r -d '' -a tag_info < <( echo "$json" | jq --raw-output '.tags | to_entries | .[] | .key + " " + .value.commit' && printf '\0' )
|
||||
@@ -49,6 +53,20 @@ for json_file in $script_dir/../../config/actions/*.json; do
|
||||
tag="${split[0]}"
|
||||
sha="${split[1]}"
|
||||
|
||||
# Check if the tag matches any ignore pattern
|
||||
skip_tag=false
|
||||
for pattern in "${ignore_patterns[@]}"; do
|
||||
if [[ "$tag" =~ $pattern ]]; then
|
||||
echo "Ignoring tag '$tag' (matches pattern '$pattern')"
|
||||
skip_tag=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$skip_tag" = true ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Append curl download command
|
||||
curl_download_commands+=("curl -s -S -L -o '$sha.tar.gz' 'https://api.github.com/repos/$owner/$repo/tarball/$sha'")
|
||||
curl_download_commands+=("curl -s -S -L -o '$sha.zip' 'https://api.github.com/repos/$owner/$repo/zipball/$sha'")
|
||||
|
||||
Reference in New Issue
Block a user