Skip to content

Skip auto-label flow when TRIGGER_STRING is unset#280

Merged
robandpdx merged 4 commits into
github:mainfrom
fortify-drussell:fix/trigger-string-undefined-guard
May 27, 2026
Merged

Skip auto-label flow when TRIGGER_STRING is unset#280
robandpdx merged 4 commits into
github:mainfrom
fortify-drussell:fix/trigger-string-undefined-guard

Conversation

@fortify-drussell
Copy link
Copy Markdown
Contributor

Summary

When TRIGGER_STRING is not configured, String.prototype.includes() coerces undefined to the literal string "undefined". A PR body or comment containing the word "undefined" could therefore falsely match and trigger the auto-label flow — applying the emergency label automatically if the sender also passes isAuthorized (which itself returns true when AUTHORIZED_TEAM is unset).

This adds an early-return guard at the top of the pull_request.opened and issue_comment.created handlers — matching the existing AUTHORIZED_TEAM check in isAuthorized — so an unset or empty TRIGGER_STRING disables the trigger feature entirely instead of matching a coerced string.

The pull_request.labeled handler does not reference TRIGGER_STRING and is unchanged.

When TRIGGER_STRING is not configured, String.prototype.includes()
coerces undefined to the literal string "undefined". A PR body or
comment containing the word "undefined" could therefore falsely match
and trigger the auto-label flow.

Add an early-return guard at the top of the pull_request.opened and
issue_comment.created handlers — matching the existing AUTHORIZED_TEAM
check in isAuthorized — so an unset or empty TRIGGER_STRING disables
the trigger feature entirely instead of matching a coerced string.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prevents false-positive auto-labeling when TRIGGER_STRING is unset by adding an early-return guard in the pull_request.opened and issue_comment.created handlers, so the trigger feature is effectively disabled unless explicitly configured.

Changes:

  • Added an early-return guard in pull_request.opened when TRIGGER_STRING is unset/empty.
  • Added an early-return guard in issue_comment.created when TRIGGER_STRING is unset/empty.
Show a summary per file
File Description
app.js Adds guards to skip auto-label trigger matching when TRIGGER_STRING is not configured.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 6

Comment thread app.js
Comment thread app.js
Comment thread app.js
Comment thread app.js
Comment thread app.js
Comment thread app.js
@robandpdx robandpdx merged commit 513bfa8 into github:main May 27, 2026
1 check passed
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