Skip to content

Add optional TRIGGERED_BY_EMAIL to mention who triggered the build - #7

Open
AndreiHippo wants to merge 1 commit into
fivexl:masterfrom
AndreiHippo:feat/triggered-by-email
Open

Add optional TRIGGERED_BY_EMAIL to mention who triggered the build#7
AndreiHippo wants to merge 1 commit into
fivexl:masterfrom
AndreiHippo:feat/triggered-by-email

Conversation

@AndreiHippo

Copy link
Copy Markdown

Problem

The approval message identifies two people: the commit's committer and its author. Neither is reliably a person.

On GitHub, every commit created by the platform itself — squash merges, merge commits, rebase merges, web-editor edits, API-created commits — is committed as GitHub <noreply@github.com>. On a protected branch that only ever receives merges through the merge button, that is every commit. Sampling ~200 commits on main across five of our repos, 185 had noreply@github.com as the committer; the handful that didn't were local pushes.

The author is whoever opened the pull request, which is often a bot (Dependabot, a code-review app). So an approval request can arrive with no human mentioned at all, even though a person just pressed Merge and is waiting on the deploy:

Commit message: `Update workflow file .github/workflows/ai-code-review.yml (#345)`
Committer: noreply@github.com
Author: 263481705+hippo-code-reviewer[bot]@users.noreply.github.com

That identity does exist — CI knows it (github.triggering_actor on GitHub Actions, GITLAB_USER_EMAIL on GitLab) — there's just no way to hand it to Magic Button.

Change

A new optional TRIGGERED_BY_EMAIL variable. When set, a Triggered by line is added to the details block, resolving the email to a Slack mention and falling back to the plain email — the same treatment the committer and author lines already get. When unset, the message is byte-for-byte what it is today.

Committer: noreply@github.com
Author: 263481705+hippo-code-reviewer[bot]@users.noreply.github.com
Triggered by: <@U01ANDREI>

Testing

  • flake8 and pylint -E clean, per lint.sh.
  • Rendered the details block through main.py with Slack and git stubbed, across all three paths: email resolvable in Slack (mention), email unknown to Slack (plain-text fallback), and variable unset (unchanged output).

Commits are not always made by a person. On GitHub, squash merges and merge
commits made through the web UI are committed as `GitHub <noreply@github.com>`,
and the author is whoever opened the pull request - which can itself be a bot.
In that case neither of the two identities in the approval message points at
the person waiting on the deploy, so nobody gets mentioned.

Let CI pass that identity in via the new optional TRIGGERED_BY_EMAIL variable.
When set, a `Triggered by` line is added to the message, mentioning the person
if the email matches a Slack profile and falling back to the plain email if it
does not - same behaviour as the existing committer and author lines. When it
is unset, the message is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant