Skip to content

Add on.skip-author-associations pre-activation gating by author_association#31836

Merged
pelikhan merged 5 commits into
mainfrom
copilot/add-skip-author-association-field
May 13, 2026
Merged

Add on.skip-author-associations pre-activation gating by author_association#31836
pelikhan merged 5 commits into
mainfrom
copilot/add-skip-author-association-field

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

New Feature

This adds a frontmatter trigger guard for skipping runs by author association on specific events, compiled into a job-level if so matching runs are skipped before pre-activation logic executes.
The feature supports both single-string and array forms per event, using github.event.author_association.

  • What does this feature do?

    • Introduces on.skip-author-associations (event → association list mapping).
    • Supports:
      • single string: issue_comment: contributor
      • string array: pull_request_review_comment: [first_time_contributor, none]
    • Normalizes configured associations case-insensitively (lower/upper input accepted).
  • Why is this feature needed?

    • Allows policy-level skipping for known low-value event/association combinations without invoking runtime checks.
    • Reduces unnecessary run cost by compiling directly into the pre-activation job condition.
  • Implementation details

    • Schema: added on.skip-author-associations with per-event value type string | string[].
    • Compiler extraction: parses and normalizes associations to canonical uppercase.
    • Job generation: emits pre-activation if terms using github.event_name + github.event.author_association.
    • Lock rendering/docs: comments skip-author-associations in rendered on: section; updated frontmatter and maintainer docs.
    • Workflow adoption: updated ai-moderator workflow to use the new field.
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  skip-author-associations:
    issue_comment: contributor
    pull_request_review_comment: [first_time_contributor, none]

Copilot AI and others added 3 commits May 13, 2026 01:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add on.skip-author-associations pre-activation skip condition Add on.skip-author-associations pre-activation gating by author_association May 13, 2026
Copilot AI requested a review from pelikhan May 13, 2026 01:31
@pelikhan pelikhan marked this pull request as ready for review May 13, 2026 01:39
Copilot AI review requested due to automatic review settings May 13, 2026 01:39
Copy link
Copy Markdown
Contributor

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

Adds a new frontmatter trigger guard (on.skip-author-associations) that is compiled into a pre-activation job-level if expression to skip runs early based on (event_name, author_association) combinations.

Changes:

  • Introduces on.skip-author-associations extraction + normalization into WorkflowData.
  • Emits a job-level pre-activation if guard compiled from configured event → association lists.
  • Updates schema/docs and adopts the feature in the ai-moderator workflow; adds unit tests.
Show a summary per file
File Description
pkg/workflow/skip_author_associations_test.go Adds tests for extraction and lockfile compilation output.
pkg/workflow/role_checks.go Extracts/normalizes on.skip-author-associations from frontmatter.
pkg/workflow/frontmatter_extraction_yaml.go Attempts to comment out skip-author-associations in rendered on: YAML.
pkg/workflow/compiler_types.go Adds SkipAuthorAssociations to WorkflowData.
pkg/workflow/compiler_pre_activation_job.go Builds skip-author-associations condition and combines it into the pre-activation job if.
pkg/workflow/compiler_orchestrator_workflow.go Wires extraction into workflow compilation.
pkg/workflow/compiler_jobs.go Ensures pre-activation job is generated when skip-author-associations is configured.
pkg/parser/schemas/main_workflow_schema.json Adds schema for on.skip-author-associations.
docs/src/content/docs/reference/frontmatter.md Documents the new frontmatter field.
docs/src/content/docs/guides/maintaining-repos.md Adds maintainer guidance for association-based early skipping.
.github/workflows/ai-moderator.md Adopts skip-author-associations in the source workflow frontmatter.
.github/workflows/ai-moderator.lock.yml Updates generated lock workflow output (currently invalid YAML per stored comment).

Copilot's findings

Tip

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

  • Files reviewed: 12/12 changed files
  • Comments generated: 7

Comment on lines +642 to +646
associationIsSkipped := BuildFunctionCall(
"contains",
BuildFunctionCall("fromJSON", BuildStringLiteral(string(associationJSON))),
BuildPropertyAccess("github.event.author_association"),
)
Comment on lines +341 to +346
// Check if we're entering skip-author-associations object
if !inPullRequest && !inIssues && !inDiscussion && !inIssueComment && !inSkipAuthorAssociations {
if strings.HasPrefix(trimmedLine, "skip-author-associations:") && trimmedLine == "skip-author-associations:" {
inSkipAuthorAssociations = true
}
}
Comment thread .github/workflows/ai-moderator.lock.yml Outdated
Comment on lines +71 to +82
issue_comment:
- owner
- member
- collaborator
issues:
- owner
- member
- collaborator
pull_request:
- owner
- member
- collaborator
Comment on lines +75 to +86
assert.Contains(t, preActivationSection, "github.event.author_association")
assert.Contains(t, preActivationSection, "github.event_name == 'issue_comment'")
assert.Contains(t, preActivationSection, "github.event_name == 'pull_request_review_comment'")
assert.Contains(t, preActivationSection, "CONTRIBUTOR")
assert.Contains(t, preActivationSection, "FIRST_TIME_CONTRIBUTOR")
assert.Contains(t, preActivationSection, "NONE")
assert.Contains(t, preActivationSection, "!(")
assert.Contains(t, preActivationSection, "||")
assert.Contains(t, preActivationSection, "&&")

assert.Contains(t, lockContentStr, "# skip-author-associations:")
assert.NotContains(t, lockContentStr, "skip-author-association:")
Comment on lines +356 to +375
### Skip Author Associations (`on.skip-author-associations`)

Skip workflow execution at the pre-activation job level when a specific event is triggered by an author with a matching `github.event.author_association`.

```yaml wrap
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
skip-author-associations:
issue_comment: contributor
pull_request_review_comment: [first_time_contributor, none]
```

**Behavior**:

- Compiles to a job-level `if` expression (no pre-activation script step cost for matched skips)
- Uses `github.event.author_association`
- Values are case-insensitive in frontmatter (`contributor` and `CONTRIBUTOR` are treated the same)
issue_comment: [owner, member, collaborator]
```

This compiles into a pre-activation job-level `if` guard (using `github.event.author_association`), so matching runs are skipped before agent execution starts.
},
"skip-author-associations": {
"type": "object",
"description": "Skip workflow execution when github.event.author_association matches configured associations for specific events. Keys are event names (for example: issue_comment, pull_request_review_comment, issues, pull_request). Values accept a single string or an array of strings. Association values are case-insensitive in frontmatter.",
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and review all comments and recompile

Copilot AI and others added 2 commits May 13, 2026 01:55
…or-association-field

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 13, 2026

@copilot merge main and review all comments and recompile

Done in bcedfc7.

Merged main, addressed the requested review follow-ups (event-specific author_association paths, valid commented skip-author-associations lock rendering, tests/docs/schema updates), and recompiled ai-moderator.lock.yml.

@pelikhan pelikhan merged commit e3dce43 into main May 13, 2026
@pelikhan pelikhan deleted the copilot/add-skip-author-association-field branch May 13, 2026 02: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