Skip to content

Commit 1466c7d

Browse files
fix(ci): exact match for webex package and handle empty outputs
- Use exact match grep (^webex$) to avoid matching @webex/* packages - Add fallback to empty arrays for JSON.parse to handle missing outputs
1 parent adc729c commit 1466c7d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/workflows/pr-comment-bot.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ jobs:
9090
9191
echo "packages=${PACKAGES_JSON}" >> $GITHUB_OUTPUT
9292
93-
# Check if webex is in the packages list
94-
if echo "$PACKAGES" | grep -q "webex"; then
93+
# Check if webex is in the packages list (exact match, not @webex/*)
94+
if echo "$PACKAGES_CLEAN" | tr ',' '\n' | grep -q "^webex$"; then
9595
echo "primary_package=webex" >> $GITHUB_OUTPUT
96-
echo "✅ webex detected in packages"
96+
echo "✅ webex detected in packages (exact match)"
9797
else
9898
# Use first package
9999
PRIMARY=$(echo "$PACKAGES_CLEAN" | tr ',' '\n' | head -1 | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
@@ -187,11 +187,12 @@ jobs:
187187
script: |
188188
const version = '${{ steps.version-info.outputs.version }}';
189189
const versionNumber = '${{ steps.version-info.outputs.version_number }}';
190-
const prNumbers = JSON.parse('${{ steps.get-prs.outputs.pr_numbers }}');
191-
const packages = JSON.parse('${{ steps.get-packages.outputs.packages }}');
190+
// Handle missing outputs gracefully with fallback to empty arrays
191+
const prNumbers = JSON.parse('${{ steps.get-prs.outputs.pr_numbers }}' || '[]');
192+
const packages = JSON.parse('${{ steps.get-packages.outputs.packages }}' || '[]');
192193
const primaryPackage = '${{ steps.get-packages.outputs.primary_package }}' || 'webex';
193-
const commits = JSON.parse('${{ steps.get-prs.outputs.commits }}');
194-
const commitCount = '${{ steps.get-prs.outputs.commit_count }}';
194+
const commits = JSON.parse('${{ steps.get-prs.outputs.commits }}' || '[]');
195+
const commitCount = '${{ steps.get-prs.outputs.commit_count }}' || '0';
195196
196197
console.log(`Posting comments to ${prNumbers.length} PRs`);
197198
console.log(`📦 Packages detected: ${packages.length}`);

0 commit comments

Comments
 (0)