Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,49 @@ jobs:
echo "Newest tag ${new_tag} does not match package.json version ${package_version}" >&2
exit 1
fi

package_name="$(node -p "JSON.parse(require('fs').readFileSync('package.json', 'utf8')).name")"
package_url="https://www.npmjs.com/package/${package_name}/v/${package_version}"
release_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${new_tag}"
repo_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"

if [ -n "${PREVIOUS_TAG}" ]; then
changelog="$(git log --no-merges --reverse --pretty='format:- %s (%H-%h)' "${PREVIOUS_TAG}..${new_tag}" | grep -v '^- chore(release): ' || true)"
else
changelog="$(git log --no-merges --reverse --pretty='format:- %s (%H-%h)' "${new_tag}" | grep -v '^- chore(release): ' || true)"
fi

if [ -z "${changelog}" ]; then
changelog='- No additional commits listed.'
else
changelog="$(printf '%s\n' "${changelog}" | sed -E -e 's,\(([a-f0-9]+)-([a-f0-9]+)\),([`\2`]('"${repo_url}"'/commit/\1)),g' | sed -E -e 's,\(#([0-9]+)\),([#\1]('"${repo_url}"'/pull/\1)),g')"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The sed regex that converts (fullhash-shorthash) into a commit link is not anchored to end-of-line. The git log format (--pretty='format:- %s (%H-%h)') always appends the hash at the end of each line, so a commit message containing its own (hexstring-hexstring) pattern — e.g., fix: handle (abc-def) — would cause the regex to match the wrong text and produce a spurious link.

Add $ to anchor the match:

sed -E -e 's,\(([a-f0-9]+)-([a-f0-9]+)\)$,([`\2`]('"${repo_url}"'/commit/\1)),g'

(For clarity, $ goes before the closing ,g in the pattern: \)$ instead of \).)

fi

echo "released=true" >> "$GITHUB_OUTPUT"
echo "version=${package_version}" >> "$GITHUB_OUTPUT"
{
echo "message<<EOF"
echo "**Comms MCP ${new_tag} published** 🚀"
echo
printf '%s\n' "${changelog}"
echo
echo "[GitHub release](${release_url}) | [npm package](${package_url})"
echo "EOF"
} >> "$GITHUB_OUTPUT"

- name: Announce release in Comms
if: ${{ steps.published.outputs.released == 'true' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 This condition retains GitHub Actions' implicit success() check, so the announcement is skipped when semantic-release fails after publishing. The preceding detection step deliberately uses !cancelled() to handle that partial-release path, and the integrations steps do the same. Use if: ${{ !cancelled() && steps.published.outputs.released == 'true' }} here so a published version is announced even if a later release plugin fails.

uses: Doist/comms-actions/post-comment-action@aeeefe3270ad30d0c4cdd7dbf94b2fac1dcb8ceb
with:
comms-client-id: ${{ secrets.COMMS_DOISTBOT_CLIENT_ID }}
comms-client-secret: ${{ secrets.COMMS_DOISTBOT_CLIENT_SECRET }}
comms-username: ${{ secrets.COMMS_DOISTBOT_USER }}
comms-password: ${{ secrets.COMMS_DOISTBOT_PASSWORD }}
workspace-id: 69
thread-id: CZER8KY4dS7idQxrb8hvg
content: ${{ steps.published.outputs.message }}
audience: thread
continue-on-error: true

- name: Generate todoist-ai-integrations token
if: ${{ !cancelled() && steps.published.outputs.released == 'true' }}
Expand Down
Loading