Skip to content

Commit d9a3851

Browse files
committed
implement NPM
Signed-off-by: Jefferson <jefferson.rios.caro@gmail.com>
1 parent b2f5b15 commit d9a3851

2 files changed

Lines changed: 28 additions & 8 deletions

File tree

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: "{{ env.VULN_ID }} ({{ env.VULN_DEP_NAME }}) found on {{ env.NODEJS_STREAM }}"
33
asignees:
4-
labels: "{{ env.ISSUE_LABELS }}"
4+
labels:
5+
{{ env.ISSUE_LABELS }}
56
---
67

78
A new vulnerability for {{ env.VULN_DEP_NAME }} {{ env.VULN_DEP_VERSION }} was found:

.github/workflows/check-vulns.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,47 @@ jobs:
9090
- name: Build labels for issue
9191
id: build_labels
9292
run: |
93-
# Start with base labels
94-
LABELS="${{ inputs.nsolidStream }}"
93+
# Start with base labels array
94+
LABELS_ARRAY=()
95+
LABELS_ARRAY+=("${{ inputs.nsolidStream }}")
9596
9697
# Add NPM label if it's an npm vulnerability
9798
if [ "${{ matrix.vulnerabilities.source }}" = "npm" ]; then
98-
LABELS="${LABELS}, NPM"
99+
LABELS_ARRAY+=("NPM")
99100
fi
100101
101102
# Add severity label if available
102103
if [ -n "${{ matrix.vulnerabilities.severity }}" ] && [ "${{ matrix.vulnerabilities.severity }}" != "null" ]; then
103104
SEVERITY=$(echo "${{ matrix.vulnerabilities.severity }}" | tr '[:lower:]' '[:upper:]')
104-
LABELS="${LABELS}, ${SEVERITY}"
105+
LABELS_ARRAY+=("${SEVERITY}")
105106
fi
106107
107108
# Extract runtime version from stream (e.g., node-v20.x-nsolid-v5.x -> v20.x)
108109
RUNTIME_VERSION=$(echo "${{ inputs.nsolidStream }}" | sed -n 's/.*node-\(v[0-9]*\.x\).*/\1/p')
109110
if [ -n "$RUNTIME_VERSION" ]; then
110-
LABELS="${LABELS}, ${RUNTIME_VERSION}"
111+
LABELS_ARRAY+=("${RUNTIME_VERSION}")
111112
fi
112113
113-
echo "ISSUE_LABELS=${LABELS}" >> $GITHUB_ENV
114-
echo "Generated labels: ${LABELS}"
114+
# Extract nsolid version from stream (e.g., node-v20.x-nsolid-v5.x -> v5.x)
115+
NSOLID_VERSION=$(echo "${{ inputs.nsolidStream }}" | sed -n 's/.*nsolid-\(v[0-9]*\.x\).*/\1/p')
116+
if [ -n "$NSOLID_VERSION" ]; then
117+
LABELS_ARRAY+=("nsolid-${NSOLID_VERSION}")
118+
fi
119+
120+
# Join array elements with newlines for proper YAML array format
121+
LABELS_YAML=""
122+
for label in "${LABELS_ARRAY[@]}"; do
123+
if [ -z "$LABELS_YAML" ]; then
124+
LABELS_YAML="$label"
125+
else
126+
LABELS_YAML="$LABELS_YAML\n$label"
127+
fi
128+
done
129+
130+
echo "ISSUE_LABELS<<EOF" >> $GITHUB_ENV
131+
echo -e "$LABELS_YAML" >> $GITHUB_ENV
132+
echo "EOF" >> $GITHUB_ENV
133+
echo "Generated labels: ${LABELS_ARRAY[*]}"
115134
- uses: dblock/create-a-github-issue@v3
116135
with:
117136
update_existing: false

0 commit comments

Comments
 (0)