Skip to content

Commit 4ddccf9

Browse files
Update generate-newsletter.yml
1 parent 5ae5810 commit 4ddccf9

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

.github/workflows/generate-newsletter.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,36 @@ jobs:
2222
- name: Extract values from issue body
2323
id: vars
2424
run: |
25-
body="${{ github.event.issue.body }}"
26-
25+
cat << 'EOF' > body.txt
26+
${{ github.event.issue.body }}
27+
EOF
28+
2729
echo "--------- RAW ISSUE BODY ---------"
28-
echo "$body"
30+
cat body.txt
2931
echo "----------------------------------"
30-
31-
# Parse the body using reliable pattern matching
32-
month=$(echo "$body" | awk '/### Newsletter Month/ {getline; print}' | xargs)
33-
year=$(echo "$body" | awk '/### Newsletter Year/ {getline; print}' | xargs)
34-
32+
33+
# Parse using awk from the saved file
34+
month=$(awk '/### Newsletter Month/ {getline; print}' body.txt | xargs)
35+
year=$(awk '/### Newsletter Year/ {getline; print}' body.txt | xargs)
36+
3537
if [ -z "$month" ] || [ -z "$year" ]; then
3638
echo "❌ Could not extract month or year from issue body."
3739
exit 1
3840
fi
39-
40-
# Convert month name to number
41+
4142
month_num=$(date -d "$month 1" '+%m')
4243
date="${year}-${month_num}-01"
4344
branch="feature/newsletter-${year}-${month_num}"
4445
filename="_posts/${date}-newsletter.md"
45-
46+
4647
echo "✅ Parsed values:"
4748
echo " Month: $month"
4849
echo " Year: $year"
4950
echo " Month Num: $month_num"
5051
echo " Date: $date"
5152
echo " Branch: $branch"
5253
echo " Filename: $filename"
53-
54+
5455
echo "month=$month" >> $GITHUB_OUTPUT
5556
echo "month_num=$month_num" >> $GITHUB_OUTPUT
5657
echo "year=$year" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)