Skip to content

Commit

Permalink
Scaffolding summarizer into bot
Browse files Browse the repository at this point in the history
  • Loading branch information
trm109 committed Aug 26, 2024
1 parent f92232a commit 792af12
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 34 deletions.
16 changes: 16 additions & 0 deletions .github/actions/bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ function buildCommand(uuid, payload, name, args) {
return new EchoCommand(uuid, payload, args);
case "ci":
return new CICommand(uuid, payload, args);
case "summarize"
return new SummarizeCommand(uuid, payload, args);
default:
console.log(`Unknown command: ${name}`);
return null;
Expand Down Expand Up @@ -147,6 +149,20 @@ class EchoCommand {
}
}

class SummarizeCommand {
constructor(uuid, payload, args){
console.log("Constructor");
console.log(JSON.stringify(uuid));
console.log(JSON.stringify(payload));
console.log(JSON.stringify(args));
}

async run(author, github) {
console.log("Run!");
console.log(JSON.stringify(author));
console.log(JSON.stringify(github));
}
}
class CICommand {
workflow_goal_prefix = "workflow:";
constructor(uuid, payload, args) {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bot-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- created
jobs:
bot:
if: ${{ github.event.issue.pull_request }}
#if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
permissions: write-all
steps:
Expand Down
66 changes: 33 additions & 33 deletions .github/workflows/summarize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,36 @@ permissions:
env:
AWS_REGION : "us-west-2"
jobs:
summarize:
if: contains(github.event.comment.body, '/summarize')
runs-on: ubuntu-latest
steps:
# Checkout the repo
- name: Checkout repository
uses: actions/checkout@v2
# Get Nodejs lib
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
# Install github actions lib
- name: Install github actions lib
run: npm install @actions/[email protected]
- name: Install core actions lib
run: npm install @actions/core
- name: Install aws bedrock lib
run: npm install @aws-sdk/client-bedrock-runtime
# Get AWS Credentials
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.BEDROCK_ACTION_ROLE_ARN }}
aws-region: ${{ env.AWS_REGION }}
role-session-name: GITHUB_ACTION
# invoke Bedrock to summarize the issue
- name: Summarize issues
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODEL_ID : "anthropic.claude-3-5-sonnet-20240620-v1:0"
COMMENT_BODY: ${{ github.event.comment.body }}
run: node .github/actions/summarizer/index.js
#summarize:
# if: contains(github.event.comment.body, '/summarize')
# runs-on: ubuntu-latest
# steps:
# # Checkout the repo
# - name: Checkout repository
# uses: actions/checkout@v2
# # Get Nodejs lib
# - name: Set up Node.js
# uses: actions/setup-node@v2
# with:
# node-version: '14'
# # Install github actions lib
# - name: Install github actions lib
# run: npm install @actions/[email protected]
# - name: Install core actions lib
# run: npm install @actions/core
# - name: Install aws bedrock lib
# run: npm install @aws-sdk/client-bedrock-runtime
# # Get AWS Credentials
# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# role-to-assume: ${{ secrets.BEDROCK_ACTION_ROLE_ARN }}
# aws-region: ${{ env.AWS_REGION }}
# role-session-name: GITHUB_ACTION
# # invoke Bedrock to summarize the issue
# - name: Summarize issues
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# MODEL_ID : "anthropic.claude-3-5-sonnet-20240620-v1:0"
# COMMENT_BODY: ${{ github.event.comment.body }}
# run: node .github/actions/summarizer/index.js

0 comments on commit 792af12

Please sign in to comment.