From 5ef122dd914eb5abaea7cb97fdd533dc72acee73 Mon Sep 17 00:00:00 2001 From: davida-ps Date: Wed, 25 Feb 2026 18:07:57 +0200 Subject: [PATCH] feat: enhance platform detection and handling in advisory workflows (#70) --- .github/workflows/community-advisory.yml | 28 ++++++++++ .github/workflows/poll-nvd-cves.yml | 65 ++++++++++++++++++------ 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/.github/workflows/community-advisory.yml b/.github/workflows/community-advisory.yml index 5b3cbc3..7cf1883 100644 --- a/.github/workflows/community-advisory.yml +++ b/.github/workflows/community-advisory.yml @@ -117,6 +117,32 @@ jobs: fi echo "Affected: $AFFECTED" + # Build platforms array + OPENCLAW_SELECTED="false" + if echo "$ISSUE_BODY" | grep -qi '^[[:space:]]*-[[:space:]]*\[[xX]\][[:space:]]*OpenClaw'; then + OPENCLAW_SELECTED="true" + fi + + OTHER_PLATFORM_RAW=$(echo "$ISSUE_BODY" | sed -n 's/^[[:space:]]*-[[:space:]]*\[[xX]\][[:space:]]*Other:[[:space:]]*\(.*\)$/\1/p' | head -1 | xargs) + OTHER_PLATFORM="" + if [ -n "$OTHER_PLATFORM_RAW" ]; then + OTHER_PLATFORM=$(echo "$OTHER_PLATFORM_RAW" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9._-]+/-/g; s/^-+//; s/-+$//') + if echo "$OTHER_PLATFORM" | grep -q 'nanoclaw'; then + OTHER_PLATFORM="nanoclaw" + fi + fi + + PLATFORMS=$(jq -n --arg open "$OPENCLAW_SELECTED" --arg other "$OTHER_PLATFORM" ' + [ + (if $open == "true" then "openclaw" else empty end), + (if ($other | length) > 0 then $other else empty end) + ] | unique + ') + if [ "$PLATFORMS" = "[]" ]; then + PLATFORMS='["openclaw","nanoclaw"]' + fi + echo "Platforms: $PLATFORMS" + # Parse recommended action ACTION=$(echo "$ISSUE_BODY" | sed -n '/^## Recommended Action/,/^---/p' | grep -v '^## Recommended Action' | grep -v '^---' | grep -v '^