Skip to content

Commit 3c417c6

Browse files
Update generate-newsletter.yml
1 parent b9f79af commit 3c417c6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/generate-newsletter.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,24 @@ jobs:
1616
- name: Extract values from issue body
1717
id: vars
1818
run: |
19-
month=$(echo "${{ github.event.issue.body }}" | grep -i "Newsletter Month" -A 1 | tail -n 1 | xargs)
20-
year=$(echo "${{ github.event.issue.body }}" | grep -i "Newsletter Year" -A 1 | tail -n 1 | xargs)
21-
# Convert month name to MM
19+
body="${{ github.event.issue.body }}"
20+
21+
echo "Raw issue body:"
22+
echo "$body"
23+
24+
month=$(echo "$body" | awk '/### Newsletter Month/ {getline; print}' | xargs)
25+
year=$(echo "$body" | awk '/### Newsletter Year/ {getline; print}' | xargs)
26+
27+
if [ -z "$month" ] || [ -z "$year" ]; then
28+
echo "❌ Could not extract month or year from issue body."
29+
exit 1
30+
fi
31+
2232
month_num=$(date -d "$month 1" '+%m')
2333
date="${year}-${month_num}-01"
2434
branch="feature/newsletter-${year}-${month_num}"
2535
filename="_posts/${date}-newsletter.md"
26-
36+
2737
echo "month=$month" >> $GITHUB_OUTPUT
2838
echo "month_num=$month_num" >> $GITHUB_OUTPUT
2939
echo "year=$year" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)