-
Notifications
You must be signed in to change notification settings - Fork 64
82 lines (73 loc) · 2.72 KB
/
aws-genai-cicd-suite.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Intelligent Code Review
# Enable manual trigger
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize]
# Avoid running the same workflow on the same branch concurrently
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
review:
runs-on: ubuntu-latest
environment: AWS_ROLE_TO_ASSUME
permissions:
# read repository contents and write pull request comments
id-token: write
# allow github action bot to push new content into existing pull requests
contents: write
# contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies @actions/core and @actions/github
run: |
npm install @actions/core
npm install @actions/github
shell: bash
# check if required dependencies @actions/core and @actions/github are installed
- name: Check if required dependencies are installed
run: |
npm list @actions/core
npm list @actions/github
shell: bash
- name: Debug GitHub Token and environment variables
run: |
if [ -n "${{ secrets.GITHUB_TOKEN }}" ]; then
echo "GitHub Token is set"
else
echo "GitHub Token is not set"
fi
if [ -n "${{ vars.AWS_ROLE_TO_ASSUME_VAR }}" ]; then
echo "Role to Assume is set"
else
echo "Role to Assume is not set"
# assume the specified IAM role and set up the AWS credentials for use in subsequent steps.
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
# using repository environment variable to get the role arn
role-to-assume: ${{ vars.AWS_ROLE_TO_ASSUME_VAR }}
aws-region: us-east-1
- name: Intelligent GitHub Actions
uses: aws-samples/aws-genai-cicd-suite@stable
with:
# Automatic Provision: The GITHUB_TOKEN is automatically created and provided by GitHub for each workflow run. You don't need to manually create or store this token as a secret.
github-token: ${{ secrets.GITHUB_TOKEN }}
aws-region: us-east-1
model-id: anthropic.claude-3-sonnet-20240229-v1:0
generate-code-review: 'true'
generate-code-review-level: 'detailed'
generate-code-review-exclude-files: '*.md,*.json,*.js'
generate-pr-description: 'true'
generate-unit-test: 'false'
generate-unit-test-source-folder: 'debugging'
# Removed the invalid input 'generate-unit-test-exclude-files'
# output-language: 'zh'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}