Skip to content

Support wildcard suffix matching for slash_command#40369

Merged
pelikhan merged 4 commits into
mainfrom
copilot/update-slash-command-wildcard-suffix
Jun 19, 2026
Merged

Support wildcard suffix matching for slash_command#40369
pelikhan merged 4 commits into
mainfrom
copilot/update-slash-command-wildcard-suffix

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

This updates slash_command to accept a trailing *, enabling prefix-based matching so one workflow can handle a family of related command names. The change applies consistently to both decentralized command checks and centralized command routing.

  • Trigger semantics

    • slash_command.name now supports a wildcard suffix.
    • A config like smoke* matches commands such as smoke-copilot and smoke-copilot-sdk.
    • The workflow receives the actual matched command name, not the wildcard pattern.
  • Decentralized matching

    • Updated pre-activation command checks to treat * as a prefix matcher instead of an exact literal.
    • Preserved existing exact-match behavior for non-wildcard commands.
  • Centralized routing

    • Updated the centralized router to resolve routes by wildcard prefix as well as exact name.
    • Routing now dispatches using the concrete matched command so downstream workflow context stays precise.
  • Shared runtime handling

    • Added a shared slash-command matcher used by routing, pre-activation validation, and command neutralization.
    • This keeps wildcard behavior aligned across compile-time conditions and JS runtime helpers.
  • Schema and docs surface

    • Extended schema validation to allow a trailing * in command names and documented the new behavior in field descriptions.

Example:

on:
  slash_command:
    name: smoke*
    strategy: centralized

With that configuration, comments like these would match the same workflow:

/smoke-copilot
/smoke-copilot-sdk run tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Support wildcard suffixes for slash_command triggers Support wildcard suffix matching for slash_command Jun 19, 2026
Copilot AI requested a review from pelikhan June 19, 2026 17:56
@pelikhan pelikhan marked this pull request as ready for review June 19, 2026 18:06
Copilot AI review requested due to automatic review settings June 19, 2026 18:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends on.slash_command to support a trailing * wildcard suffix for prefix-based matching, and wires that behavior through both decentralized activation checks (compiled if: conditions) and centralized routing/JS runtime helpers so a single workflow can handle a family of related command names.

Changes:

  • Added wildcard-aware slash-command matching in the Go workflow condition builder (startsWith("/<prefix>") for name: prefix*).
  • Introduced a shared JS matcher module and updated routing, command-position validation, and command neutralization to use it.
  • Updated the workflow schema patterns/descriptions and added tests covering wildcard matching across Go + JS paths.
Show a summary per file
File Description
pkg/workflow/command.go Adds wildcard-suffix detection and emits startsWith conditions for wildcard command names.
pkg/workflow/command_precision_test.go Adds coverage ensuring wildcard slash commands compile to prefix checks.
pkg/parser/schemas/main_workflow_schema.json Allows an optional trailing * in slash command names and documents wildcard behavior.
actions/setup/js/slash_command_matcher.cjs New shared JS helper for parsing and matching exact vs wildcard command names.
actions/setup/js/sanitize_content.test.cjs Adds a test ensuring wildcard-configured commands are neutralized correctly.
actions/setup/js/sanitize_content_core.cjs Uses the shared matcher to neutralize the actual matched command name (including wildcard matches).
actions/setup/js/route_slash_command.test.cjs Adds tests for dot-containing commands and wildcard routing dispatch behavior.
actions/setup/js/route_slash_command.cjs Switches routing to shared parsing/matching and resolves routes by wildcard prefix as well as exact name.
actions/setup/js/check_command_position.test.cjs Adds tests for wildcard matching in both workflow_dispatch aw_context and comment bodies.
actions/setup/js/check_command_position.cjs Updates command-position validation to use shared parsing/matching for wildcard support.

Copilot's findings

Tip

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

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

Comment on lines +11 to +14
function parseSlashCommand(text) {
const match = /^\/([a-zA-Z0-9][a-zA-Z0-9._-]*)\b/.exec(String(text).trim());
return match ? match[1] : "";
}
@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed during code quality review.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot Investigate why reviewers were unable to create safe-outputs.

https://github.com/github/gh-aw/actions/runs/27841406528/job/82402381056

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Investigate why reviewers were unable to create safe-outputs.

https://github.com/github/gh-aw/actions/runs/27841406528/job/82402381056

Root cause was a runtime packaging gap in actions/setup/setup.sh: sanitize_content_core.cjs now requires ./slash_command_matcher.cjs, but that file was not included in SAFE_OUTPUTS_FILES, so the safe-outputs MCP server failed to start (Cannot find module './slash_command_matcher.cjs').

Fixed in commit f7bf6c5 by adding slash_command_matcher.cjs to SAFE_OUTPUTS_FILES.

@pelikhan

Copy link
Copy Markdown
Collaborator

/smoke-copilot

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Circuits hum at dawn
Smoke curls through the workflow tree
Bots sing checks to life

Note

This comment is managed by comment memory.

It stores persistent context for this thread in the code block at the top of this comment.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

Warning

Firewall blocked 5 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · 406.4 AIC · ⊞ 19.2K ·

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Smoke run: inline notes attached.

Warning

Firewall blocked 5 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · 406.4 AIC · ⊞ 19.2K

@pelikhan

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix test https://github.com/github/gh-aw/actions/runs/27844995118/job/82412161598?pr=40369

Fixed in 0995042. I tightened slash-command parsing to require whitespace/end after the command (so punctuation-suffixed tokens no longer match) and updated/addded JS tests accordingly.

@pelikhan pelikhan merged commit bbf619a into main Jun 19, 2026
37 checks passed
@pelikhan pelikhan deleted the copilot/update-slash-command-wildcard-suffix branch June 19, 2026 21:03
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