首页 > 解决方案 > 如何使用 cdk 将 github repo 与 aws 连接?

问题描述

我正在学习 aws cdk 并尝试制作代码管道。

我在 github 上创建了个人访问密钥并将其保存在 aws secret manager 上。

然后在我的 cdk 堆栈中我写了`

pipeline.addStage({
      stageName:"Source",
      actions:[
        new CodePipelineAction.GitHubSourceAction({
          actionName: 'CheckOut',
          owner: 'Mahmood787',
          repo: "aws-pipeline",
          oauthToken: cdk.SecretValue.secretsManager('github2'),
          output:sourceOutput,
          branch:"master" 
        })
      ]
    });

在 cdk deploy 上我得到这个错误

无法在 GitHub 上注册 Webhook。错误原因:凭据无效 [StatusCode: 401, Body: {"message":"Bad credentials","documentation_url":"https://docs.github.com/rest"}]

我有什么遗漏吗?

标签: amazon-web-servicesgithubpipelineaws-cdk

解决方案


推荐阅读