Skip to content

Commit 85b70ec

Browse files
Update generate-newsletter.yml
1 parent 4ddccf9 commit 85b70ec

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

.github/workflows/generate-newsletter.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,18 @@ jobs:
1919
echo "${{ github.event.issue.body }}"
2020
echo "-------------------------------------------"
2121
22-
- name: Extract values from issue body
22+
- name: Extract values from issue title
2323
id: vars
2424
run: |
25-
cat << 'EOF' > body.txt
26-
${{ github.event.issue.body }}
27-
EOF
25+
title="${{ github.event.issue.title }}"
2826
29-
echo "--------- RAW ISSUE BODY ---------"
30-
cat body.txt
31-
echo "----------------------------------"
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)
27+
# Extract month and year using awk
28+
month=$(echo "$title" | awk -F': ' '{print $2}' | awk '{print $1}')
29+
year=$(echo "$title" | awk -F': ' '{print $2}' | awk '{print $2}')
3630

3731
if [ -z "$month" ] || [ -z "$year" ]; then
38-
echo "❌ Could not extract month or year from issue body."
32+
echo "❌ Could not extract month or year from title."
33+
echo "Title was: $title"
3934
exit 1
4035
fi
4136

@@ -45,6 +40,7 @@ jobs:
4540
filename="_posts/${date}-newsletter.md"
4641

4742
echo "✅ Parsed values:"
43+
echo " Title: $title"
4844
echo " Month: $month"
4945
echo " Year: $year"
5046
echo " Month Num: $month_num"

0 commit comments

Comments
 (0)