forked from strands-agents/harness-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 2.1 KB
/
Copy pathissue-responder.yml
File metadata and controls
65 lines (55 loc) · 2.1 KB
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
name: Issue Responder
on:
issues:
types: [opened]
permissions:
id-token: write
contents: read
jobs:
respond-to-issue:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.STRANDS_AGENTCORE_ACTIONS_ROLE }}
aws-region: us-west-2
- name: Invoke AgentCore with issue details
env:
GH_ISSUE_AGENTCORE_RUNTIME_ARN: ${{ secrets.GH_ISSUE_AGENTCORE_RUNTIME_ARN }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
REPO: ${{ github.repository }}
run: |
pip install boto3
python3 - <<'PYEOF'
import boto3
import json
import os
import uuid
client = boto3.client('bedrock-agentcore', region_name='us-west-2')
payload = json.dumps({
"source": "github",
"action": "issue_opened",
"issue": {
"number": int(os.environ['ISSUE_NUMBER']),
"title": os.environ['ISSUE_TITLE'],
"body": os.environ['ISSUE_BODY'],
"url": os.environ['ISSUE_URL'],
"author": os.environ['ISSUE_AUTHOR'],
"repo": os.environ['REPO']
}
})
print("Invoking AgentCore with payload:")
print(json.dumps(json.loads(payload), indent=2))
response = client.invoke_agent_runtime(
agentRuntimeArn=os.environ['GH_ISSUE_AGENTCORE_RUNTIME_ARN'],
runtimeSessionId=f"github-issue-{os.environ['ISSUE_NUMBER']}-{uuid.uuid4().hex[:8]}",
payload=payload.encode()
)
response_body = response['response'].read()
print("Response:", response_body.decode())
PYEOF