Skip to content

Automate custom agent assignment in weekly maintenance workflow#49

Merged
Malcolmnixon merged 2 commits intomainfrom
copilot/fix-weekly-maintenance-task
Dec 27, 2025
Merged

Automate custom agent assignment in weekly maintenance workflow#49
Malcolmnixon merged 2 commits intomainfrom
copilot/fix-weekly-maintenance-task

Conversation

Copy link
Contributor

Copilot AI commented Dec 27, 2025

The Weekly Maintenance workflow creates issues but doesn't automatically assign the project-maintainer custom agent, requiring manual intervention.

Changes

  • GraphQL agent lookup: Query repository.customAgent(slug: "project-maintainer") to retrieve agent ID
  • Agent assignment: Use assignCopilotAgentToAssignable mutation to bind agent to created issue
  • Error handling: Fallback to comment-based mentions if GraphQL operations fail
  • Permissions: Added id-token: write for agent assignment API access

Implementation

// Query for agent ID
const agentResponse = await github.graphql(agentQuery, {
  owner: context.repo.owner,
  repo: context.repo.repo,
  slug: 'project-maintainer'
});

// Assign agent to issue
await github.graphql(assignMutation, {
  assignableId: issue.data.node_id,
  customAgentId: agentResponse.repository.customAgent.id
});

The workflow now automatically assigns the agent on issue creation, enabling true hands-off weekly maintenance.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Weekly maintenance task is not automatically starting</issue_title>
<issue_description>### Problem Statement

The Weekly Maintenance tries to kick off the 'project-maintainer' custom GitHub agent to keep the project up to date every week; however the 'project-maintainer' custom GitHub agent does not run.

Proposed Solution

It seems like the correct way to kick off a copilot agent is to extend the actions/github-script step to:

  1. Query the customAgentId for the 'project-maintainer' custom GitHub agent
  2. Create the issue and save the issue ID (already done)
  3. Use the GraphQL API to perform the assignCopilotAgentToAssignable mutation to assign the issue to the customAgentId

Alternatives Considered

No response

Usage Examples

Benefits

This would allow for periodic automatic maintenance of the project.

Priority

Medium - Would improve my workflow

Willingness to Contribute

Yes, I can submit a pull request

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have provided a clear description of the feature
  • I have explained why this feature would be useful</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix weekly maintenance task not starting automatically Automate custom agent assignment in weekly maintenance workflow Dec 27, 2025
Copilot AI requested a review from Malcolmnixon December 27, 2025 17:52
@Malcolmnixon Malcolmnixon marked this pull request as ready for review December 27, 2025 18:47
@Malcolmnixon Malcolmnixon merged commit 2a8cd92 into main Dec 27, 2025
8 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/fix-weekly-maintenance-task branch December 27, 2025 18:49
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.

[Feature]: Weekly maintenance task is not automatically starting

2 participants