Skip to content

Commit 7f3ca0d

Browse files
authored
ci: post to mastodon (#201)
next attempt: filtering out the pr title string, hopefully corrected <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated GitHub workflow script for Mastodon posting - Added checks for release pull requests - Improved version number extraction process - Enhanced error handling for missing PR title <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 363f130 commit 7f3ca0d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/post_to_mastodon.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#!/bin/bash
22

33
# Extract version from PR tag passed as environment variable
4-
if [ -z "${PR_TITLE}" ]; then # apparently unset, workflow broken?
4+
if [ -z "${PR_TITLE}" ]; then
55
echo "Error: 'PR_TITLE' environment variable is not set."
66
exit 1
77
fi
8-
version="${PR_TITLE##* }"
8+
9+
# Check if this is a release PR
10+
if [[ ! "${PR_TITLE}" =~ ^chore\(main\):\ release ]]; then
11+
echo "Not a release PR, skipping Mastodon post"
12+
exit 0
13+
fi
14+
15+
# Extract version (everything after "release ")
16+
if [[ "${PR_TITLE}" =~ [Rr]elease[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+) ]]; then
17+
version="${BASH_REMATCH[1]}"
18+
else
19+
echo "Error: Could not extract version number from PR title"
20+
exit 1
21+
fi
922

1023
# Validate version format
1124
if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then

0 commit comments

Comments
 (0)