Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting GitHub Actions Secrets as request parameters on GithubApiCall #7

Closed
pflorek opened this issue Oct 31, 2022 · 0 comments · Fixed by #53
Closed

Support setting GitHub Actions Secrets as request parameters on GithubApiCall #7

pflorek opened this issue Oct 31, 2022 · 0 comments · Fixed by #53
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pflorek
Copy link
Member

pflorek commented Oct 31, 2022

To merge with https://github.com/WtfJoke/cdk-github we need to support the feature to https://docs.github.com/en/rest/actions/secrets#create-or-update-a-repository-secret

See:

https://github.com/WtfJoke/cdk-github/blob/a30cc750581010e769c390b320158c92e705ada2/src/handler/secrets/github-secret-encryptor.ts#L1-L23

A possible solution could be wrapping the SecretsManager Secrets or the SSM ParameterStore StringParameter by a class and using a symbol/identifier that can be used on JSON.parse in the lambda handler like PhysicalResourceIdReference

@pflorek pflorek added enhancement New feature or request help wanted Extra attention is needed labels Oct 31, 2022
pflorek added a commit that referenced this issue Nov 16, 2022
#7

```typescript
new GithubCustomResource(stack, "ActionsSecret", {
  onCreate: {
    endpoint: "actions",
    method: "createOrUpdateRepoSecret",
    parameters: {
      owner: "pepperize",
      repo: "cdk-github",
      secret_name: "any-name",
      value: ActionsSecret.fromSecretsManager(secret, "any-field"),
    },
    outputPaths: [],
    physicalResourceId: custom_resources.PhysicalResourceId.of("any-id"),
  },
  authOptions: AuthOptions.appAuth(authSecret),
});
```
@mergify mergify bot closed this as completed in #53 Feb 1, 2023
mergify bot added a commit that referenced this issue Feb 1, 2023
Usage:

```typescript
new GithubCustomResource(stack, "ActionsSecret", {
  onCreate: {
    endpoint: "actions",
    method: "createOrUpdateRepoSecret",
    parameters: {
      owner: "pepperize",
      repo: "cdk-github",
      secret_name: "any-name",
      value: ActionsSecret.fromSecretsManager(secret, "any-field"),
    },
    outputPaths: [],
    physicalResourceId: custom_resources.PhysicalResourceId.of("any-id"),
  },
  authOptions: AuthOptions.appAuth(authSecret),
});
```

Fixes #7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant