New-GitHubAgentAutomationRepoAutomationTask
SYNOPSIS
Run an automation
SYNTAX
Default (Default)
New-GitHubAgentAutomationRepoAutomationTask [-Owner] <string> [-Repo] <string>
[-AutomationId] <string> -BodyEvent <string> [-Context <string>] [-Accept <string>] [-WhatIf]
[-Confirm]
Body
New-GitHubAgentAutomationRepoAutomationTask [-Owner] <string> [-Repo] <string>
[-AutomationId] <string> -Body <Object> [-BodyEvent <string>] [-Context <string>]
[-Accept <string>] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- Get-GHNewAgentAutomationRepoAutomationTask
DESCRIPTION
The New-GitHubAgentAutomationRepoAutomationTask cmdlet invokes the POST method of the /agents/repos/{owner}/{repo}/automations/{automation_id}/tasks endpoint (Run an automation)
[!NOTE] This endpoint is in public preview and is subject to change.
Runs an automation in a repository. Set ‘event’ to ‘manual’ and optionally include ‘context’ of up to 10,000 characters, which will be injected into the automation’s prompt.
The repository must have the “Allow automations” setting enabled, and the automation must be a personal automation belonging to you or a shared automation.
GitHub App installation access tokens can run shared automations. The installation must belong to the repository owner and the token must have “Agent tasks” repository permissions (write). Personal automations require a user token.
A successful response accepts the run request and includes a preallocated ‘task_id’. User tokens can fetch it with the “Get a task by repo” Agent tasks API. GitHub App installation tokens can list tasks for the automation in the repository and match the returned ‘task_id’. The response does not confirm execution or task creation. Task creation is asynchronous, so fetching the task immediately may return ‘404 Not Found’, and downstream skips or failures can prevent its creation.
To call this endpoint, you must have write access to the repository.
To call this endpoint, OAuth app tokens and personal access tokens (classic) need the ‘repo’ scope.
Fine-grained access tokens for “Run an automation”
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens (https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app)
- GitHub App installation access tokens (https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app)
- Fine-grained personal access tokens (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token)
The fine-grained token must have the following permission set:
- “Agent tasks” repository permissions (write)
Endpoint: POST /agents/repos/{owner}/{repo}/automations/{automation_id}/tasks API version: 2026-03-10
EXAMPLES
EXAMPLE 1
' -BodyEvent m -Body @{ key = 'value' }
Invokes POST /agents/repos/{owner}/{repo}/automations/{automation_id}/tasks
EXAMPLE 2
' -Body @{ event = m }
Sends the request body from a hashtable, parameters override the keys of -Body
PARAMETERS
-Accept
The Accept header (media type) of the request Default value: application/vnd.github+json
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-AutomationId
The unique identifier of the automation.
Path parameter [ automation_id ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Body
The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values Configuration for the automation run.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-BodyEvent
The event to trigger. Only ‘manual’ is supported.
Required unless -Body is used
Body property [ event ]
Allowed values: ‘manual’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
- Name: Default
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Context
Additional context for this automation run, up to 10,000 characters. Supported only when ‘event’ is ‘manual’. The context supplements the automation’s configured instructions.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner
The account owner of the repository. The name is not case sensitive.
Path parameter [ owner ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repo
The name of the repository. The name is not case sensitive.
Path parameter [ repo ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf
Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Objects with properties named like the path parameters can be piped to this function
{{ Fill in the Description }}
System.String
{{ Fill in the Description }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: agent-automations/create-repo-automation-task Category: agent-automations / agent-automations