Skip to content

feat: add disable_agentic_workflow label-triggered job to maintenance workflow#29269

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-agentic-maintenance-action
Draft

feat: add disable_agentic_workflow label-triggered job to maintenance workflow#29269
Copilot wants to merge 2 commits intomainfrom
copilot/update-agentic-maintenance-action

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 30, 2026

Summary

Adds a new job to the agentic maintenance action that triggers when an issue or pull request is labeled with agentic-workflows:disable.

How it works

  1. A maintainer/admin applies the agentic-workflows:disable label to an issue or PR created by an agentic workflow
  2. The new disable_agentic_workflow job activates (label events on issues and PRs)
  3. The job:
    • Checks that the actor has admin/maintainer permissions (via check_team_member.cjs)
    • Reads the issue/PR body and extracts the workflow_id from XML comment markers (<!-- gh-aw-workflow-id: WORKFLOW_ID --> or the combined <!-- gh-aw-agentic-workflow: ... --> marker)
    • Runs gh aw disable <workflow_id> to disable the specific agentic workflow
    • Posts a comment confirming the action (or explaining failure/missing marker)

Changes

File Change
pkg/workflow/maintenance_conditions.go New buildLabeledDisableCondition() for the label-triggered if: condition
pkg/workflow/maintenance_workflow_yaml.go Adds issues: [labeled] + pull_request: [labeled] to on:, adds disable_agentic_workflow job
actions/setup/js/disable_agentic_workflow.cjs JS implementation: body parsing, ID validation, disable command, comment posting
actions/setup/js/disable_agentic_workflow.test.cjs 15 unit tests covering extraction, validation, and security edge cases
pkg/workflow/maintenance_workflow_test.go Go tests for the new job and condition
.github/workflows/agentics-maintenance.yml Regenerated with the new job

Security

  • The combined-marker regex is scoped to <!-- gh-aw-agentic-workflow: ... --> comment blocks to prevent user content injection
  • Extracted workflow IDs are validated against isValidWorkflowId() (alphanumeric + -_., max 100 chars, no .. path traversal)
  • Only required env vars are passed to the subprocess (no ...process.env spread)
  • Only admins/maintainers can trigger the action (existing check_team_member.cjs gate)

Copilot AI and others added 2 commits April 30, 2026 06:10
… workflow

When an issue or PR is labeled with "agentic-workflows:disable":
- A new maintenance job reads the body to find the workflow_id
  from XML comment markers (gh-aw-workflow-id)
- Disables the corresponding agentic workflow via gh aw disable
- Posts a comment confirming the action

Changes:
- pkg/workflow/maintenance_conditions.go: add buildLabeledDisableCondition()
- pkg/workflow/maintenance_workflow_yaml.go: add issues/pull_request label
  triggers and disable_agentic_workflow job
- actions/setup/js/disable_agentic_workflow.cjs: new JS implementation
- actions/setup/js/disable_agentic_workflow.test.cjs: JS unit tests
- pkg/workflow/maintenance_workflow_test.go: Go unit tests for new job
- .github/workflows/agentics-maintenance.yml: regenerated

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9713fb7c-1206-4aed-9d68-08edcfbc4394

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

- Restrict combined-marker regex to gh-aw-agentic-workflow comment blocks
  to prevent matching workflow_id: in user content
- Add isValidWorkflowId() to validate extracted IDs against path traversal
  and shell-unsafe characters
- Pass only required env vars (not ...process.env spread) to exec subprocess
- Add test cases for security validation and outside-comment non-match

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9713fb7c-1206-4aed-9d68-08edcfbc4394

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.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.

2 participants