constructor()

in lib/auto-build.ts [103:132]


  constructor(scope: Construct, id: string, props: AutoBuildProps) {
    super(scope, id);

    this.project = new codebuild.Project(this, 'Project', {
      projectName: props.projectName,
      description: `Automatic PR build for ${props.repo.describe()}`,
      source: props.repo.createBuildSource(this, props.webhook ?? true, { branch: props.branch, branches: props.branches }),
      environment: createBuildEnvironment(props.environment ?? {}),
      badge: props.repo.allowsBadge,
      buildSpec: props.buildSpec,
    });

    const publicLogs = props.publicLogs !== undefined ? props.publicLogs : false;
    const githubToken = props.repo.tokenSecretArn ? SecretValue.secretsManager(props.repo.tokenSecretArn) : undefined;

    if (publicLogs) {
      new serverless.CfnApplication(this, 'GitHubCodeBuildLogsSAR', {
        location: {
          applicationId: 'arn:aws:serverlessrepo:us-east-1:277187709615:applications/github-codebuild-logs',
          semanticVersion: '1.4.0',
        },
        parameters: {
          CodeBuildProjectName: this.project.projectName,
          DeletePreviousComments: (props.deletePreviousPublicLogsLinks ?? true).toString(),
          CommentOnSuccess: (props.publicLogsOnSuccess ?? true).toString(),
          ...githubToken ? { GitHubOAuthToken: Token.asString(githubToken) } : undefined,
        },
      });
    }
  }