Amazon CodeCommit is no longer available to new customers. Existing customers of
Amazon CodeCommit can continue to use the service as normal.
Learn more"
Edit triggers for an Amazon CodeCommit repository
You can edit the triggers that have been created for a CodeCommit repository. You can change the events and branches for the trigger, the action taken in response to the event, and other settings.
Edit a trigger for a repository (console)
Open the CodeCommit console at https://console.www.amazonaws.cn/codesuite/codecommit/home
. In Repositories, choose the repository where you want to edit a trigger for repository events.
-
In the navigation pane for the repository, choose Settings, and then choose Triggers.
-
From the list of triggers for the repository, choose the trigger you want to edit, and then choose Edit.
Make the changes you want to the trigger, and then choose Save.
Edit a trigger for a repository (Amazon CLI)
At a terminal (Linux, OS X, or Unix) or command prompt (Windows), run the get-repository-triggers command to create a JSON file with the structure of all of the triggers configured for your repository. For example, to create a JSON file named
MyTriggers.json
with the structure of all of the triggers configured for a repository namedMyDemoRepo
:aws codecommit get-repository-triggers --repository-name MyDemoRepo >MyTriggers.json
This command returns nothing, but a file named
MyTriggers.json
is created in the directory where you ran the command.-
Edit the JSON file in a plain-text editor and make changes to the trigger block of the trigger you want to edit. Replace the
configurationId
pair with arepositoryName
pair. Save the file.For example, if you want to edit a trigger named
MyFirstTrigger
in the repository namedMyDemoRepo
so that it applies to all branches, replaceconfigurationId
withrepositoryName
, and remove the specifiedmain
andpreprod
branches inred italic text
. By default, if no branches are specified, the trigger applies to all branches in the repository:{ "repositoryName": "
MyDemoRepo
", "triggers": [ { "destinationArn": "arn:aws:sns:us-east-2:111122223333:MyCodeCommitTopic", "branches": ["main", "preprod"
], "name": "MyFirstTrigger", "customData": "", "events": [ "all" ] } ] } At the terminal or command line, run the put-repository-triggers command. This updates all triggers for the repository, including the changes you made to the
MyFirstTrigger
trigger:aws codecommit put-repository-triggers --repository-name
MyDemoRepo
file://MyTriggers.json
This command returns a configuration ID, similar to the following:
{ "configurationId": "
0123456-I-AM-AN-EXAMPLE
" }