pepperize.cdk-github


Namepepperize.cdk-github JSON
Version 0.0.707 PyPI version JSON
download
home_pagehttps://github.com/pepperize/cdk-github.git
SummaryManage GitHub resources like repositories, teams, members, integrations and workflows with the AWS CDK as Custom Resources in CloudFormation with [cdk-github](https://github.com/pepperize/cdk-github).
upload_time2023-12-29 23:47:24
maintainer
docs_urlNone
authorPatrick Florek<patrick.florek@gmail.com>
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
[![GitHub](https://img.shields.io/github/license/pepperize/cdk-github?style=flat-square)](https://github.com/pepperize/cdk-github/blob/main/LICENSE)
[![npm (scoped)](https://img.shields.io/npm/v/@pepperize/cdk-github?style=flat-square)](https://www.npmjs.com/package/@pepperize/cdk-github)
[![PyPI](https://img.shields.io/pypi/v/pepperize.cdk-github?style=flat-square)](https://pypi.org/project/pepperize.cdk-github/)
[![Nuget](https://img.shields.io/nuget/v/Pepperize.CDK.Github?style=flat-square)](https://www.nuget.org/packages/Pepperize.CDK.Github/)
[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.pepperize/cdk-github?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/pepperize/cdk-github/)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/pepperize/cdk-github/release.yml?branch=main&label=release&style=flat-square)](https://github.com/pepperize/cdk-github/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/pepperize/cdk-github?sort=semver&style=flat-square)](https://github.com/pepperize/cdk-github/releases)
[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/pepperize/cdk-github)

# CDK Github

Manage GitHub resources like repositories, teams, members, integrations and workflows with the AWS CDK as Custom Resources in CloudFormation with [cdk-github](https://github.com/pepperize/cdk-github).

> You configure the endpoint, method and parameters documented by [@octokit/rest](https://octokit.github.io/rest.js/v19) and AWS CloudFormation runs them anytime you create, update (if you changed the custom resource), or delete stacks. When CloudFormation sends a lifecycle event notification, then your custom resource sends the request to the [GitHub REST API](https://docs.github.com/en/rest).

[![View on Construct Hub](https://constructs.dev/badge?package=%40pepperize%2Fcdk-github)](https://constructs.dev/packages/@pepperize/cdk-github)

## Install

<details><summary><strong>TypeScript</strong></summary>

```shell
npm install @pepperize/cdk-github
```

or

```shell
yarn add @pepperize/cdk-github
```

</details><details><summary><strong>Python</strong></summary>

```shell
pip install pepperize.cdk-github
```

</details><details><summary><strong>C#</strong></summary>

```
dotnet add package Pepperize.CDK.Github
```

</details><details><summary><strong>Java</strong></summary>

```xml
<dependency>
  <groupId>com.pepperize</groupId>
  <artifactId>cdk-github</artifactId>
  <version>${cdkGithub.version}</version>
</dependency>
```

</details>

## Contributing

Contributions of all kinds are welcome :rocket: Check out our [contributor's guide](https://github.com/pepperize/cdk-github/blob/main/CONTRIBUTING.md).

For a quick start, [fork and check out](https://github.com/pepperize/cdk-github/fork) a development environment:

```shell
git clone git@github.com:pepperize/cdk-github
cd cdk-github
# install dependencies
yarn
# build with projen
yarn build
```

## Getting Started

1. [Creating a GitHub App](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app)
2. [Installing GitHub Apps](https://docs.github.com/en/developers/apps/managing-github-apps/installing-github-apps)
3. [Create an AWS Secrets Manager secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_secret.html)

   ```json
   {
     "appId": "123456",
     "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nExample==\n-----END RSA PRIVATE KEY-----",
     "installationId": "12345678"
   }
   ```
4. Add [@pepperize/cdk-github](https://github.com/pepperize/cdk-github) to your project dependencies

   ```shell
   yarn add @pepperize/cdk-github
   ```
5. Add your `main.ts`

   ```python
   const app = new App();
   const stack = new Stack(app, "GithubCustomResources");
   ```

   > Just for simplicity, it's up to you how to organize your app :wink:
6. Import your secret

   ```python
   const secret = secrets_manager.Secret.fromSecretNameV2(stack, "Auth", "cdk-github/github-token");
   ```
7. Configure GitHub App authenticate as an installation

   ```python
   const authOptions = AuthOptions.appAuth(secret);
   ```
8. Add your first GitHub Custom Resource with the AWS CDK

   ```python
   new GithubCustomResource(stack, "GithubRepo", {
     onCreate: {
       // 👇The endpoint of the GitHub API.
       endpoint: "repos",
       // 👇The method of the GitHub API.
       method: "createInOrg",
       // https://octokit.github.io/rest.js/v19/#repos-create-in-org
       parameters: {
         // 👇The request parameters to send.
         org: "pepperize",
         name: "cdk-github",
       },
       // 👇The object keys from the GitHub API response to return to CFN.
       outputPaths: ["id", "full_name"],
       // 👇This becomes the CFN Physical ID visible in the Console.
       physicalResourceId: custom_resources.PhysicalResourceId.fromResponse("full_name"),
       // 👇Don't throw an error if message matching this regex.
       ignoreErrorCodesMatching: "name already exists on this account",
     },
     // 👇The implemented authentication strategy.
     authOptions: AuthOptions.appAuth(secret),
   });
   ```
9. Deploy your first GitHub Custom Resource

   ```shell
   npx cdk deploy
   ```

## Authentication

### GitHub App or installation authentication

Configure the AWS SecretsManager Secret with the AuthOptions that will be passed to `octokit.auth`. i.e. as an installation:

```json
{
  "appId": "123456",
  "privateKey": "-----BEGIN RSA PRIVATE KEY-----\nExample==\n-----END RSA PRIVATE KEY-----",
  "installationId": "12345678"
}
```

Lookup the secret in your AWS CDK app:

```python
// 👇Lookup your secret containing the AuthOptions
const secret = secrets_manager.Secret.fromSecretNameV2(stack, "Auth", "cdk-github/github-token");
// 👇This will send the secret arn to the custom resource handler
const authOptions = AuthOptions.appAuth(secret);
```

The custom resource handler will configure [octokit.js](https://github.com/octokit/octokit.js) with the `createAppAuth`:

```python
const getSecretValueResponse = await SSM.getSecretValue({ SecretId: secret }).promise();
const octokitOptions: OctokitOptions = {
  authStrategy: createAppAuth,
  auth: (auth = JSON.parse(getSecretValueResponse.SecretString)),
};
```

> Supported through [@octokit/auth-app](https://github.com/octokit/auth-app.js#readme)

### Personal Access Token authentication

Just add your PAT to an SSM StringParameter

```python
// 👇Lookup your parameter containing the TOKEN
const parameter = ssm.StringParameter.fromStringParameterName(stack, "Auth", "cdk-github/github-token");
// 👇This will send the parameter arn to the custom resource handler
const authOptions = AuthOptions.tokenAuth(parameter);
```

> Supported through [@octokit/auth-token](https://github.com/octokit/auth-token.js)

### Unauthenticated

```python
// 👇This will configure octokit without authentication
const authOptions = AuthOptions.unauthenticated();
```

## Manage a GitHub Repository - Example

[![Manage a GitHub Repository as custom CFN resource](https://raw.githubusercontent.com/pepperize/cdk-github/main/cloudformation-stack-github-custom-resource.png)](https://github.com/pepperize/cdk-github/blob/main/src/integ.default.ts)

[@octokit/plugin-rest-endpoint-methods](https://github.com/octokit/plugin-rest-endpoint-methods.js/#usage)

```python
const auth = secrets_manager.Secret.fromSecretNameV2(stack, "Auth", "cdk-github/github-token");

const repo = new GithubCustomResource(stack, "GithubRepo", {
  onCreate: {
    // https://octokit.github.io/rest.js/v19/#repos-create-in-org
    endpoint: "repos",
    method: "createInOrg",
    parameters: {
      org: "pepperize",
      name: "cdk-github",
    },
    outputPaths: ["id", "full_name"],
    physicalResourceId: custom_resources.PhysicalResourceId.fromResponse("full_name"),
    ignoreErrorCodesMatching: "name already exists on this account",
  },
  onUpdate: {
    // https://octokit.github.io/rest.js/v19#repos-get
    endpoint: "repos",
    method: "get",
    parameters: {
      owner: "pepperize",
      repo: "cdk-github",
    },
    outputPaths: ["id", "full_name"],
    physicalResourceId: custom_resources.PhysicalResourceId.fromResponse("full_name"),
  },
  onDelete: {
    // https://octokit.github.io/rest.js/v19#repos-delete
    endpoint: "repos",
    method: "delete",
    parameters: {
      owner: "pepperize",
      repo: "cdk-github",
    },
    outputPaths: [],
  },
  authOptions: AuthOptions.appAuth(auth),
});

// 👇 This will return the created repository id as a CDK Token
repo.getAtt("id");
```

## Manage GitHub Actions Secrets

### Environment Secret

Manages an environment secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.

```python
// 👇The GitHub API authentication secret
const auth = secrets_manager.Secret.fromSecretNameV2(scope, "Auth", "cdk-github/github-token");

// 👇The AWS SecretsManager Secret to configure as GitHub Action secret.
const secret = secrets_manager.Secret.fromSecretNameV2(scope, "Secret", "any-secret/example");

new GithubActionsSecretEnvironment(scope, "GithubRepo", {
  // 👇The repository id, which you may lookup from the page source or via a custom resource
  repositoryId: "558989134",
  environmentName: "production",
  // 👇The name of the created GitHub secret
  secretName: "example",
  // 👇The source AWS SecretsManager secret and JSON field to use
  source: GithubActionsSecret.fromSecretsManager(secret, "some-json-field"),
  authOptions: AuthOptions.appAuth(auth),
  // 👇Whether to delete or retain the GitHub secret on resource removal
  removalPolicy: RemovalPolicy.DESTROY,
});
```

> You may retrieve the `repository_id` from the GitHub Repository page source's meta tag i.e. `<meta name="octolytics-dimension-repository_id" content="558989134">` or from another `GithubCustomResource` via `getAtt()`.

See [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-an-environment-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)

### Organization Secret

Manage an GitHib Actions organization secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.

```python
// 👇The GitHub API authentication secret
const auth = secrets_manager.Secret.fromSecretNameV2(scope, "Auth", "cdk-github/github-token");

// 👇The AWS SecretsManager Secret to configure as GitHub Action secret.
const secret = secrets_manager.Secret.fromSecretNameV2(scope, "Secret", "any-secret/example");

new GithubActionsSecretOrganization(scope, "GithubRepo", {
  organizationName: "pepperize",
  // 👇The name of the created GitHub secret
  secretName: "example",
  // 👇The source AWS SecretsManager secret and JSON field to use
  source: GithubActionsSecret.fromSecretsManager(secret, "some-json-field"),
  visibility: Visibility.ALL,
  authOptions: AuthOptions.appAuth(auth),
  // 👇Whether to delete or retain the GitHub secret on resource removal
  removalPolicy: RemovalPolicy.DESTROY,
});
```

See [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-an-organization-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)

### Repository Secret

Manage an GitHib Actions Repository secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.

```python
// 👇The GitHub API authentication secret
const auth = secrets_manager.Secret.fromSecretNameV2(scope, "Auth", "cdk-github/github-token");

// 👇The AWS SecretsManager Secret to configure as GitHub Action secret.
const secret = secrets_manager.Secret.fromSecretNameV2(scope, "Secret", "any-secret/example");

new GithubActionsSecretRepository(scope, "GithubRepo", {
  owner: "pepperize",
  repositoryName: "cdk-github",
  // 👇The name of the created GitHub secret
  secretName: "example",
  // 👇The source AWS SecretsManager secret and JSON field to use
  source: GithubActionsSecret.fromSecretsManager(secret, "some-json-field"),
  authOptions: AuthOptions.appAuth(auth),
  // 👇Whether to delete or retain the GitHub secret on resource removal
  removalPolicy: RemovalPolicy.DESTROY,
});
```

See [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-a-repository-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pepperize/cdk-github.git",
    "name": "pepperize.cdk-github",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "Patrick Florek<patrick.florek@gmail.com>",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5b/e1/9ae80802051b7faa45248a51b75535e27c60dfe4937afabfbe456c01b680/pepperize.cdk-github-0.0.707.tar.gz",
    "platform": null,
    "description": "[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n[![GitHub](https://img.shields.io/github/license/pepperize/cdk-github?style=flat-square)](https://github.com/pepperize/cdk-github/blob/main/LICENSE)\n[![npm (scoped)](https://img.shields.io/npm/v/@pepperize/cdk-github?style=flat-square)](https://www.npmjs.com/package/@pepperize/cdk-github)\n[![PyPI](https://img.shields.io/pypi/v/pepperize.cdk-github?style=flat-square)](https://pypi.org/project/pepperize.cdk-github/)\n[![Nuget](https://img.shields.io/nuget/v/Pepperize.CDK.Github?style=flat-square)](https://www.nuget.org/packages/Pepperize.CDK.Github/)\n[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.pepperize/cdk-github?server=https%3A%2F%2Fs01.oss.sonatype.org%2F&style=flat-square)](https://s01.oss.sonatype.org/content/repositories/releases/com/pepperize/cdk-github/)\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/pepperize/cdk-github/release.yml?branch=main&label=release&style=flat-square)](https://github.com/pepperize/cdk-github/actions/workflows/release.yml)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/pepperize/cdk-github?sort=semver&style=flat-square)](https://github.com/pepperize/cdk-github/releases)\n[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/pepperize/cdk-github)\n\n# CDK Github\n\nManage GitHub resources like repositories, teams, members, integrations and workflows with the AWS CDK as Custom Resources in CloudFormation with [cdk-github](https://github.com/pepperize/cdk-github).\n\n> You configure the endpoint, method and parameters documented by [@octokit/rest](https://octokit.github.io/rest.js/v19) and AWS CloudFormation runs them anytime you create, update (if you changed the custom resource), or delete stacks. When CloudFormation sends a lifecycle event notification, then your custom resource sends the request to the [GitHub REST API](https://docs.github.com/en/rest).\n\n[![View on Construct Hub](https://constructs.dev/badge?package=%40pepperize%2Fcdk-github)](https://constructs.dev/packages/@pepperize/cdk-github)\n\n## Install\n\n<details><summary><strong>TypeScript</strong></summary>\n\n```shell\nnpm install @pepperize/cdk-github\n```\n\nor\n\n```shell\nyarn add @pepperize/cdk-github\n```\n\n</details><details><summary><strong>Python</strong></summary>\n\n```shell\npip install pepperize.cdk-github\n```\n\n</details><details><summary><strong>C#</strong></summary>\n\n```\ndotnet add package Pepperize.CDK.Github\n```\n\n</details><details><summary><strong>Java</strong></summary>\n\n```xml\n<dependency>\n  <groupId>com.pepperize</groupId>\n  <artifactId>cdk-github</artifactId>\n  <version>${cdkGithub.version}</version>\n</dependency>\n```\n\n</details>\n\n## Contributing\n\nContributions of all kinds are welcome :rocket: Check out our [contributor's guide](https://github.com/pepperize/cdk-github/blob/main/CONTRIBUTING.md).\n\nFor a quick start, [fork and check out](https://github.com/pepperize/cdk-github/fork) a development environment:\n\n```shell\ngit clone git@github.com:pepperize/cdk-github\ncd cdk-github\n# install dependencies\nyarn\n# build with projen\nyarn build\n```\n\n## Getting Started\n\n1. [Creating a GitHub App](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app)\n2. [Installing GitHub Apps](https://docs.github.com/en/developers/apps/managing-github-apps/installing-github-apps)\n3. [Create an AWS Secrets Manager secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/create_secret.html)\n\n   ```json\n   {\n     \"appId\": \"123456\",\n     \"privateKey\": \"-----BEGIN RSA PRIVATE KEY-----\\nExample==\\n-----END RSA PRIVATE KEY-----\",\n     \"installationId\": \"12345678\"\n   }\n   ```\n4. Add [@pepperize/cdk-github](https://github.com/pepperize/cdk-github) to your project dependencies\n\n   ```shell\n   yarn add @pepperize/cdk-github\n   ```\n5. Add your `main.ts`\n\n   ```python\n   const app = new App();\n   const stack = new Stack(app, \"GithubCustomResources\");\n   ```\n\n   > Just for simplicity, it's up to you how to organize your app :wink:\n6. Import your secret\n\n   ```python\n   const secret = secrets_manager.Secret.fromSecretNameV2(stack, \"Auth\", \"cdk-github/github-token\");\n   ```\n7. Configure GitHub App authenticate as an installation\n\n   ```python\n   const authOptions = AuthOptions.appAuth(secret);\n   ```\n8. Add your first GitHub Custom Resource with the AWS CDK\n\n   ```python\n   new GithubCustomResource(stack, \"GithubRepo\", {\n     onCreate: {\n       // \ud83d\udc47The endpoint of the GitHub API.\n       endpoint: \"repos\",\n       // \ud83d\udc47The method of the GitHub API.\n       method: \"createInOrg\",\n       // https://octokit.github.io/rest.js/v19/#repos-create-in-org\n       parameters: {\n         // \ud83d\udc47The request parameters to send.\n         org: \"pepperize\",\n         name: \"cdk-github\",\n       },\n       // \ud83d\udc47The object keys from the GitHub API response to return to CFN.\n       outputPaths: [\"id\", \"full_name\"],\n       // \ud83d\udc47This becomes the CFN Physical ID visible in the Console.\n       physicalResourceId: custom_resources.PhysicalResourceId.fromResponse(\"full_name\"),\n       // \ud83d\udc47Don't throw an error if message matching this regex.\n       ignoreErrorCodesMatching: \"name already exists on this account\",\n     },\n     // \ud83d\udc47The implemented authentication strategy.\n     authOptions: AuthOptions.appAuth(secret),\n   });\n   ```\n9. Deploy your first GitHub Custom Resource\n\n   ```shell\n   npx cdk deploy\n   ```\n\n## Authentication\n\n### GitHub App or installation authentication\n\nConfigure the AWS SecretsManager Secret with the AuthOptions that will be passed to `octokit.auth`. i.e. as an installation:\n\n```json\n{\n  \"appId\": \"123456\",\n  \"privateKey\": \"-----BEGIN RSA PRIVATE KEY-----\\nExample==\\n-----END RSA PRIVATE KEY-----\",\n  \"installationId\": \"12345678\"\n}\n```\n\nLookup the secret in your AWS CDK app:\n\n```python\n// \ud83d\udc47Lookup your secret containing the AuthOptions\nconst secret = secrets_manager.Secret.fromSecretNameV2(stack, \"Auth\", \"cdk-github/github-token\");\n// \ud83d\udc47This will send the secret arn to the custom resource handler\nconst authOptions = AuthOptions.appAuth(secret);\n```\n\nThe custom resource handler will configure [octokit.js](https://github.com/octokit/octokit.js) with the `createAppAuth`:\n\n```python\nconst getSecretValueResponse = await SSM.getSecretValue({ SecretId: secret }).promise();\nconst octokitOptions: OctokitOptions = {\n  authStrategy: createAppAuth,\n  auth: (auth = JSON.parse(getSecretValueResponse.SecretString)),\n};\n```\n\n> Supported through [@octokit/auth-app](https://github.com/octokit/auth-app.js#readme)\n\n### Personal Access Token authentication\n\nJust add your PAT to an SSM StringParameter\n\n```python\n// \ud83d\udc47Lookup your parameter containing the TOKEN\nconst parameter = ssm.StringParameter.fromStringParameterName(stack, \"Auth\", \"cdk-github/github-token\");\n// \ud83d\udc47This will send the parameter arn to the custom resource handler\nconst authOptions = AuthOptions.tokenAuth(parameter);\n```\n\n> Supported through [@octokit/auth-token](https://github.com/octokit/auth-token.js)\n\n### Unauthenticated\n\n```python\n// \ud83d\udc47This will configure octokit without authentication\nconst authOptions = AuthOptions.unauthenticated();\n```\n\n## Manage a GitHub Repository - Example\n\n[![Manage a GitHub Repository as custom CFN resource](https://raw.githubusercontent.com/pepperize/cdk-github/main/cloudformation-stack-github-custom-resource.png)](https://github.com/pepperize/cdk-github/blob/main/src/integ.default.ts)\n\n[@octokit/plugin-rest-endpoint-methods](https://github.com/octokit/plugin-rest-endpoint-methods.js/#usage)\n\n```python\nconst auth = secrets_manager.Secret.fromSecretNameV2(stack, \"Auth\", \"cdk-github/github-token\");\n\nconst repo = new GithubCustomResource(stack, \"GithubRepo\", {\n  onCreate: {\n    // https://octokit.github.io/rest.js/v19/#repos-create-in-org\n    endpoint: \"repos\",\n    method: \"createInOrg\",\n    parameters: {\n      org: \"pepperize\",\n      name: \"cdk-github\",\n    },\n    outputPaths: [\"id\", \"full_name\"],\n    physicalResourceId: custom_resources.PhysicalResourceId.fromResponse(\"full_name\"),\n    ignoreErrorCodesMatching: \"name already exists on this account\",\n  },\n  onUpdate: {\n    // https://octokit.github.io/rest.js/v19#repos-get\n    endpoint: \"repos\",\n    method: \"get\",\n    parameters: {\n      owner: \"pepperize\",\n      repo: \"cdk-github\",\n    },\n    outputPaths: [\"id\", \"full_name\"],\n    physicalResourceId: custom_resources.PhysicalResourceId.fromResponse(\"full_name\"),\n  },\n  onDelete: {\n    // https://octokit.github.io/rest.js/v19#repos-delete\n    endpoint: \"repos\",\n    method: \"delete\",\n    parameters: {\n      owner: \"pepperize\",\n      repo: \"cdk-github\",\n    },\n    outputPaths: [],\n  },\n  authOptions: AuthOptions.appAuth(auth),\n});\n\n// \ud83d\udc47 This will return the created repository id as a CDK Token\nrepo.getAtt(\"id\");\n```\n\n## Manage GitHub Actions Secrets\n\n### Environment Secret\n\nManages an environment secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.\n\n```python\n// \ud83d\udc47The GitHub API authentication secret\nconst auth = secrets_manager.Secret.fromSecretNameV2(scope, \"Auth\", \"cdk-github/github-token\");\n\n// \ud83d\udc47The AWS SecretsManager Secret to configure as GitHub Action secret.\nconst secret = secrets_manager.Secret.fromSecretNameV2(scope, \"Secret\", \"any-secret/example\");\n\nnew GithubActionsSecretEnvironment(scope, \"GithubRepo\", {\n  // \ud83d\udc47The repository id, which you may lookup from the page source or via a custom resource\n  repositoryId: \"558989134\",\n  environmentName: \"production\",\n  // \ud83d\udc47The name of the created GitHub secret\n  secretName: \"example\",\n  // \ud83d\udc47The source AWS SecretsManager secret and JSON field to use\n  source: GithubActionsSecret.fromSecretsManager(secret, \"some-json-field\"),\n  authOptions: AuthOptions.appAuth(auth),\n  // \ud83d\udc47Whether to delete or retain the GitHub secret on resource removal\n  removalPolicy: RemovalPolicy.DESTROY,\n});\n```\n\n> You may retrieve the `repository_id` from the GitHub Repository page source's meta tag i.e. `<meta name=\"octolytics-dimension-repository_id\" content=\"558989134\">` or from another `GithubCustomResource` via `getAtt()`.\n\nSee [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-an-environment-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)\n\n### Organization Secret\n\nManage an GitHib Actions organization secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.\n\n```python\n// \ud83d\udc47The GitHub API authentication secret\nconst auth = secrets_manager.Secret.fromSecretNameV2(scope, \"Auth\", \"cdk-github/github-token\");\n\n// \ud83d\udc47The AWS SecretsManager Secret to configure as GitHub Action secret.\nconst secret = secrets_manager.Secret.fromSecretNameV2(scope, \"Secret\", \"any-secret/example\");\n\nnew GithubActionsSecretOrganization(scope, \"GithubRepo\", {\n  organizationName: \"pepperize\",\n  // \ud83d\udc47The name of the created GitHub secret\n  secretName: \"example\",\n  // \ud83d\udc47The source AWS SecretsManager secret and JSON field to use\n  source: GithubActionsSecret.fromSecretsManager(secret, \"some-json-field\"),\n  visibility: Visibility.ALL,\n  authOptions: AuthOptions.appAuth(auth),\n  // \ud83d\udc47Whether to delete or retain the GitHub secret on resource removal\n  removalPolicy: RemovalPolicy.DESTROY,\n});\n```\n\nSee [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-an-organization-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)\n\n### Repository Secret\n\nManage an GitHib Actions Repository secret. Will fetch the source AWS SecretsManager secret and encrypt it to store in GitHub.\n\n```python\n// \ud83d\udc47The GitHub API authentication secret\nconst auth = secrets_manager.Secret.fromSecretNameV2(scope, \"Auth\", \"cdk-github/github-token\");\n\n// \ud83d\udc47The AWS SecretsManager Secret to configure as GitHub Action secret.\nconst secret = secrets_manager.Secret.fromSecretNameV2(scope, \"Secret\", \"any-secret/example\");\n\nnew GithubActionsSecretRepository(scope, \"GithubRepo\", {\n  owner: \"pepperize\",\n  repositoryName: \"cdk-github\",\n  // \ud83d\udc47The name of the created GitHub secret\n  secretName: \"example\",\n  // \ud83d\udc47The source AWS SecretsManager secret and JSON field to use\n  source: GithubActionsSecret.fromSecretsManager(secret, \"some-json-field\"),\n  authOptions: AuthOptions.appAuth(auth),\n  // \ud83d\udc47Whether to delete or retain the GitHub secret on resource removal\n  removalPolicy: RemovalPolicy.DESTROY,\n});\n```\n\nSee [GitHub Developer Guide](https://docs.github.com/de/rest/actions/secrets#create-or-update-a-repository-secret), [API Reference](https://github.com/pepperize/cdk-github/blob/main/API.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Manage GitHub resources like repositories, teams, members, integrations and workflows with the AWS CDK as Custom Resources in CloudFormation with [cdk-github](https://github.com/pepperize/cdk-github).",
    "version": "0.0.707",
    "project_urls": {
        "Homepage": "https://github.com/pepperize/cdk-github.git",
        "Source": "https://github.com/pepperize/cdk-github.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "044b50340b97d6139bbb4aed64a0338868850899493bc2a75ecaaace0d294ac3",
                "md5": "ea6c00d7d47239dbc1e747d235f0b92e",
                "sha256": "e1c8cc1cec13bcf6ce7fed05e72a9389b3d94c83c5d18a56caa010ab563024a7"
            },
            "downloads": -1,
            "filename": "pepperize.cdk_github-0.0.707-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ea6c00d7d47239dbc1e747d235f0b92e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 703760,
            "upload_time": "2023-12-29T23:47:17",
            "upload_time_iso_8601": "2023-12-29T23:47:17.612041Z",
            "url": "https://files.pythonhosted.org/packages/04/4b/50340b97d6139bbb4aed64a0338868850899493bc2a75ecaaace0d294ac3/pepperize.cdk_github-0.0.707-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5be19ae80802051b7faa45248a51b75535e27c60dfe4937afabfbe456c01b680",
                "md5": "fcd9242bba48c4f072ec505a2a1a6f9e",
                "sha256": "a5e229c5b427a47b3678e83382772db8e43ec7c2eebe1254a52ef95a943c7e2c"
            },
            "downloads": -1,
            "filename": "pepperize.cdk-github-0.0.707.tar.gz",
            "has_sig": false,
            "md5_digest": "fcd9242bba48c4f072ec505a2a1a6f9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 702123,
            "upload_time": "2023-12-29T23:47:24",
            "upload_time_iso_8601": "2023-12-29T23:47:24.426362Z",
            "url": "https://files.pythonhosted.org/packages/5b/e1/9ae80802051b7faa45248a51b75535e27c60dfe4937afabfbe456c01b680/pepperize.cdk-github-0.0.707.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-29 23:47:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pepperize",
    "github_project": "cdk-github",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pepperize.cdk-github"
}
        
Elapsed time: 0.17652s