Skip to content

feat(ci): name the publisher and author in publish notifications - #1107

Merged
trieloff merged 6 commits into
mainfrom
improve-publish-notifications
Sep 9, 2026
Merged

feat(ci): name the publisher and author in publish notifications#1107
trieloff merged 6 commits into
mainfrom
improve-publish-notifications

Conversation

@trieloff

@trieloff trieloff commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Track Publishes has always dispatched who published a resource. The Slack step used only the path, so the message could not tell you that one person published another's work — which is the normal shape of things here: authors edit, a smaller set of people publish.

Test Plan

Preview link (workflow-only change, no page affected): https://improve-publish-notifications--aem-website--adobe.aem.page/

After merge, the next publish posts to Slack. To see it sooner, publish any page and watch Actions → Log Publish.

Before and after

Today, for the real publish of /docs/edge-delivery-service-configuration on 1 Sept:

Just published: https://www.aem.live/docs/edge-delivery-service-configuration

After:

@bohnert published /docs/edge-delivery-service-configuration, authored by @msagolj

That example is not invented — the version history shows version-by: bohnert@adobe.com against doc-last-modified-by: msagolj@adobe.com on that exact publish.

The author is credited only when it differs from the publisher; one person doing both reads as noise. The author comes from the source bus version history (doc-last-modified-by on the newest version), which is the only place that distinction is recorded — the publish log knows who pressed publish, not who wrote it.

No new secrets

Handles are the email's local part — msagolj@adobe.com becomes @msagolj, which this workspace links and notifies on.

The only secret used is AEM_LIVE_ADMIN_TOKEN, which already exists and is what finds the author. If that lookup fails the message still names the publisher, it just cannot credit an author — a failed lookup never costs you the notification.

Two bugs fixed along the way

Silent drops. Both Slack steps were gated on endsWith(path, '.md') or '.json'. ADD_MD_SUFFIX only adds .md to paths with no dot at all, so a published .png, .pdf, .svg or .xml matched neither condition and produced no message and no error. Every publish is announced now.

A global regex where a suffix strip was meant. replace-string-action with pattern \.md removes every occurrence, so /docs/using.md-files.md would have come out as /docs/using-files. There is a test for exactly that path.

Verification

  • npm run lint and npm test pass; 11 new tests cover path handling and every message shape.
  • The builder was exercised against the real 1 Sept publish with the source bus stubbed, covering six shapes: publisher ≠ author, publisher = author, data file, media file, no admin token, and unknown publisher.
  • No change to .eslintrc.js, deliberately — feat: add YouTube chapter markers to community feed #880 adds an overrides block there and I did not want a conflict, so the script avoids console rather than configuring around it.

🤖 Generated with Claude Code

Track Publishes has always dispatched who published a resource, and the Slack
step used only the path - so the message could not tell you that one person
published another's work, which is the normal shape of things here: authors
edit, a smaller set of people publish.

The message now names both, crediting the author only when it differs from
the publisher, and links the page rather than printing a bare URL. The author
comes from the source bus version history (`doc-last-modified-by` on the
newest version), which is the only place that distinction is recorded.

Slack only notifies on the `<@U012AB3CD>` id form - a plain `@name` renders as
text and pings nobody - so emails are resolved through users.lookupByEmail when
SLACK_BOT_TOKEN is set. Without that secret the message still reads correctly
with `@name` handles, it just does not notify. Same for the admin token: no
token means no author credit, not a failed run.

Two smaller fixes along the way. Anything that was not `.md` or `.json` matched
neither step's endsWith condition and produced no message at all, so published
images, PDFs and sitemaps vanished silently; every publish is announced now.
And the `.md` strip was a global regex, which would have mangled a path like
`/docs/using.md-files`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Lars Trieloff <lars@trieloff.net>
@aem-code-sync
aem-code-sync Bot temporarily deployed to improve-publish-notifications September 4, 2026 08:43 Inactive
Copilot AI lite review requested due to automatic review settings September 4, 2026 08:43
@aem-code-sync

aem-code-sync Bot commented Sep 4, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run all PSI checks
  • Re-run failed PSI checks
  • Re-sync branch
Commits

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aem-code-sync

aem-code-sync Bot commented Sep 4, 2026

Copy link
Copy Markdown
Page Scores Audits Google
📱 / Lighthouse returned error: Something went wrong. PSI
🖥️ / PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

The workspace links and notifies on the `@name` form already, so resolving
emails to `<@U...>` ids bought nothing and cost a new SLACK_BOT_TOKEN secret
plus a users.lookupByEmail call on every publish. Removed both.

The message is unchanged apart from the mention form, and the module loses a
third of its code along with its only Slack dependency. The AEM admin token
stays - it is what finds the author, and it is a secret that already exists.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Lars Trieloff <lars@trieloff.net>
@aem-code-sync
aem-code-sync Bot temporarily deployed to improve-publish-notifications September 4, 2026 09:01 Inactive
@trieloff
trieloff requested a review from asthabh23 September 7, 2026 07:07
@aem-code-sync
aem-code-sync Bot temporarily deployed to improve-publish-notifications September 8, 2026 14:26 Inactive
@trieloff
trieloff requested a review from rofe September 8, 2026 14:49
@trieloff
trieloff merged commit 31b2f2d into main Sep 9, 2026
4 of 6 checks passed
@trieloff
trieloff deleted the improve-publish-notifications branch September 9, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants