Skip to content

Commit dd8832c

Browse files
better parsing
1 parent ce56e0a commit dd8832c

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/create-article-from-issue.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,25 @@ jobs:
4343
id: extract
4444
run: |
4545
echo "${{ github.event.issue.body }}" > issue_body.txt
46-
46+
47+
echo "Extracted issue body:"
4748
cat issue_body.txt
48-
49-
FILEID=$(grep -oP '(?<=\*\*Google doc\*\*: ).*' issue_body.txt | sed 's|.*\/d/||' | sed 's|/.*||')
50-
AUTHOR=$(grep -oP '(?<=\*\*Profile\*\*: ).*' issue_body.txt)
51-
TAGS=$(grep -oP '(?<=\*\*Tags\*\*: ).*' issue_body.txt)
49+
echo "------------------------"
50+
51+
while IFS= read -r line; do
52+
KEY=$(echo "$line" | cut -d':' -f1 | xargs)
53+
VALUE=$(echo "$line" | cut -d':' -f2- | xargs)
54+
55+
if [ "$KEY" = "Title" ]; then
56+
TITLE="$VALUE"
57+
elif [ "$KEY" = "Google doc" ]; then
58+
FILEID="$VALUE"
59+
elif [ "$KEY" = "Profile" ]; then
60+
AUTHOR="$VALUE"
61+
elif [ "$KEY" = "Tags" ]; then
62+
TAGS="$VALUE"
63+
fi
64+
done < issue_body.txt
5265
5366
echo "Extracted values:"
5467
echo "File ID: $FILEID"

0 commit comments

Comments
 (0)