Skip to content

[BUG] Test first bug report #3

[BUG] Test first bug report

[BUG] Test first bug report #3

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