Skip to content

Commit a47da13

Browse files
committed
ci: NO-JIRA add test email parameter in blog comms
1 parent ed76c27 commit a47da13

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/send-blog-communications.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
description: 'Path to the blog post markdown file (e.g., apps/dialtone-documentation/docs/about/whats-new/posts/2026-1-14.md)'
77
required: true
88
type: string
9+
test_email:
10+
description: 'Optional: Send to this email address instead of the production list (for testing)'
11+
required: false
12+
type: string
913
workflow_run:
1014
workflows: ["Deploy"]
1115
types:
@@ -67,7 +71,7 @@ jobs:
6771
matrix:
6872
files: ${{ fromJSON(needs.added-posts.outputs.added_posts) }}
6973
env:
70-
TO_MAIL: dialtone-users@dialpad.com
74+
TO_MAIL: ${{ github.event.inputs.test_email || 'dialtone-users@dialpad.com' }}
7175
FILE_PATH: ${{ matrix.files }}
7276
API_URL: https://us-central1-dp-dialtone-design-system.cloudfunctions.net/send-email
7377
steps:
@@ -93,13 +97,10 @@ jobs:
9397
# - Remove blog post component.
9498
# - Remove comments.
9599
# - Remove empty lines at the beginning of the file.
96-
# - Escape quotes
97-
# - Escape double quotes
98-
# - Add new line escaped character at the end of every line
99100
# - Replace links paths for their absolute paths (prefixed by https://dialtone.dialpad.com).
100101
# - Ellipsis the article to the first 10 lines.
101102
# - Append the URL of the article at the end of the article.
102-
# - Print the result to MESSAGE_BODY env variable removing the new lines to avoid issues with JSON
103+
# - Store the result in MESSAGE_BODY env variable (jq will handle JSON escaping)
103104
- name: Process Markdown file
104105
run: |
105106
sed -i -E \
@@ -108,16 +109,13 @@ jobs:
108109
-e '/^<\/*BlogPost.*$/d' \
109110
-e '/^<!--.*$/d' \
110111
-e '/./,$!d' \
111-
-e "s/'/'\\\''/g" \
112-
-e 's/"/\\"/g' \
113-
-e 's/$/\\n/g' \
114112
-e 's_(\[.*\])\(([^)]+)\)_\1(https://dialtone.dialpad.com\2)_g' \
115113
$FILE_PATH;
116114
sed -i -e '10q' $FILE_PATH;
117-
echo -e "... Read the full article: $POST_URL" >> $FILE_PATH;
115+
echo -e "\n... Read the full article: $POST_URL" >> $FILE_PATH;
118116
{
119117
echo 'MESSAGE_BODY<<EOF'
120-
cat $FILE_PATH | tr -d '\n'
118+
cat $FILE_PATH
121119
echo
122120
echo EOF
123121
} >> $GITHUB_ENV;
@@ -146,6 +144,7 @@ jobs:
146144
send-sms:
147145
name: Send SMS
148146
runs-on: ubuntu-latest
147+
if: ${{ github.event.inputs.test_email == '' || github.event_name != 'workflow_dispatch' }}
149148
permissions:
150149
contents: read
151150
id-token: write

0 commit comments

Comments
 (0)