2
votes

I am trying to create my CodePipeline using CloudFormation. The problem I'm having is that once it's created and tries to run, it immediately gives me the error:

Invalid action configuration The GitHub repository "MyOrg/MyRepo" or branch "MyBranch" does not exist.

When in fact they both do. I can click on Edit, select my source control, Connect to GitHub, then select that exact repository and branch, and it works fine. But when starting the pipeline directly following the CloudFormation provisioning of the pipeline, it always gives me this error.

I did an export of the pipeline configuration JSON using aws codepipeline get-pipeline of a freshly provisioned pipeline using CloudFormation, and then did so again immediately after updating the configuration in the console using "Connect to GitHub" and both are identical.

1

1 Answers

3
votes

Make sure that the Configuration property for your CodePipeline's GitHub Source Action contains all four required properties as listed in the documentation:

  • Owner
  • Repo
  • Branch
  • OAuthToken

Double check that your provided values are correct, particularly OAuthToken, which approximates the "Connect To GitHub" step in the the AWS Console-based CodePipeline setup.

To get a valid OAuthToken from GitHub to enter here, you need to create a New personal access token with repo and admin:repo_hook scopes enabled, as described in the documentation troubleshooting page.