https://github.com/scriptsmith/cdk-github-actions-role
Create an IAM role with permissions to perform GitHub actions tasks
https://github.com/scriptsmith/cdk-github-actions-role
aws cdk github-actions oidc
Last synced: 4 months ago
JSON representation
Create an IAM role with permissions to perform GitHub actions tasks
- Host: GitHub
- URL: https://github.com/scriptsmith/cdk-github-actions-role
- Owner: ScriptSmith
- Created: 2025-08-29T02:06:40.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-08-29T03:22:21.000Z (5 months ago)
- Last Synced: 2025-08-29T07:33:55.070Z (5 months ago)
- Topics: aws, cdk, github-actions, oidc
- Language: TypeScript
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CDK Github Actions Role
This CDK Construct Library project provides a construct (`CdkGithubActionsRole`) that creates an IAM role with permissions to perform GitHub Actions tasks.
## Usage
CDK stack generating the Role:
```typescript
import * as cdk from "aws-cdk-lib";
import { CdkGithubActionsRole } from "@scriptsmith/cdk-github-actions-role";
const stack = new cdk.Stack();
const githubRole = new CdkGithubActionsRole(stack, "MyTestConstruct", {
owner: "my-owner",
repository: "my-repo",
});
cdk.CfnOutput(stack, "RoleArn", {
value: githubRole.role.roleArn,
});
```
GitHub action using the generated Role's ARN:
```yaml
jobs:
deploy:
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-southeast-2
role-to-assume: ${{ secrets.ROLE_ARN }}
role-duration-seconds: 1800
output-credentials: true
mask-aws-account-id: true
- name: Deploy CDK
run: npm run cdk deploy
```