New-GitHubRepositoryDispatchEvent
SYNOPSIS
Create a repository dispatch event
SYNTAX
Default (Default)
New-GitHubRepositoryDispatchEvent [-Owner] <string> [-Repo] <string> -EventType <string>
[-ClientPayload <Object>] [-Accept <string>] [-WhatIf] [-Confirm]
Body
New-GitHubRepositoryDispatchEvent [-Owner] <string> [-Repo] <string> -Body <Object>
[-EventType <string>] [-ClientPayload <Object>] [-Accept <string>] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- Get-GHNewRepositoryDispatchEvent
DESCRIPTION
The New-GitHubRepositoryDispatchEvent cmdlet invokes the POST method of the /repos/{owner}/{repo}/dispatches endpoint (Create a repository dispatch event)
You can use this endpoint to trigger a webhook event called ‘repository_dispatch’ when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the ‘repository_dispatch’ event occurs. For an example ‘repository_dispatch’ webhook payload, see “RepositoryDispatchEvent (https://docs.github.com/webhooks/event-payloads/#repository_dispatch).”
The ‘client_payload’ parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the ‘client_payload’ can include a message that a user would like to send using a GitHub Actions workflow. Or the ‘client_payload’ can be used as a test to debug your workflow.
This input example shows how you can use the ‘client_payload’ as a test to debug your workflow.
OAuth app tokens and personal access tokens (classic) need the ‘repo’ scope to use this endpoint.
Endpoint: POST /repos/{owner}/{repo}/dispatches API version: 2026-03-10
EXAMPLES
EXAMPLE 1
New-GitHubRepositoryDispatchEvent -Owner 'octocat' -Repo 'Hello-World' -EventType 'on-demand-test' -Body @{ key = 'value' }
Invokes POST /repos/{owner}/{repo}/dispatches
EXAMPLE 2
New-GitHubRepositoryDispatchEvent -Owner 'octocat' -Repo 'Hello-World' -Body @{ event_type = 'on-demand-test' }
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: ''
-Body
The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
Position: Named
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-ClientPayload
JSON payload with extra information about the webhook event that your action or workflow may use. The maximum number of top-level properties is 10. The total size of the JSON payload must be less than 64KB.
Body property [ client_payload ]
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
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: ''
-EventType
A custom webhook event name. Must be 100 characters or fewer.
Required unless -Body is used
Body property [ event_type ]
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: ''
-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 without the ‘.git’ extension. 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: repos/create-dispatch-event Category: repos / repos