Skip to content

Commit 6a2db3b

Browse files
authored
Change AWS APM workflow to use Claude Code integration (#256)
*Description of changes:* Change GitHub Actions to use claude code By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 78cce7b commit 6a2db3b

1 file changed

Lines changed: 56 additions & 11 deletions

File tree

.github/workflows/awsapm.yml

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1-
name: Application observability for AWS
1+
# Example workflow for Claude Code with Amazon Bedrock
2+
#
3+
# This workflow demonstrates how to use the Application Observability for AWS action
4+
# with Claude Code and a custom Bedrock model.
5+
#
6+
# Key Features:
7+
# - Brings your own Bedrock model (pay-per-token usage on your AWS account)
8+
# - Uses Anthropic's official claude-code-base-action for execution
9+
# - Two-step process: preparation + execution
10+
#
11+
# Prerequisites:
12+
# 1. AWS IAM role with OIDC trust for GitHub Actions
13+
# 2. Bedrock InvokeModel permissions in your IAM role
14+
# 3. Application Signals and CloudWatch permissions
15+
#
16+
# Setup:
17+
# 1. Create repository secret AWSAPM_ROLE_ARN with your IAM role ARN
18+
# 2. (Optional) Set repository variable AWS_REGION for your preferred region
19+
# 3. Copy this file to .github/workflows/awsapm.yml in your repository
20+
21+
name: Application observability for AWS (Claude + Bedrock)
222

323
on:
424
issue_comment:
@@ -8,29 +28,54 @@ on:
828

929
jobs:
1030
awsapm-investigation:
31+
# Only run when @awsapm is mentioned
1132
if: |
1233
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@awsapm')) ||
1334
(github.event_name == 'issues' && (contains(github.event.issue.body, '@awsapm') || contains(github.event.issue.title, '@awsapm')))
1435
runs-on: ubuntu-latest
36+
1537
permissions:
16-
contents: write
17-
pull-requests: write
18-
issues: write
19-
id-token: write
38+
contents: write # To create branches for PRs
39+
pull-requests: write # To post comments on PRs
40+
issues: write # To post comments on issues
41+
id-token: write # Required for AWS OIDC authentication
42+
2043
steps:
2144
- name: Checkout repository
2245
uses: actions/checkout@v4
23-
with:
24-
fetch-depth: 1
2546

2647
- name: Configure AWS credentials
2748
uses: aws-actions/configure-aws-credentials@v4
2849
with:
29-
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} # this should be the ARN of the IAM role created for Github Actions
50+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
3051
aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
3152

32-
- name: Run Application observability for AWS Investigation
33-
id: awsapm
34-
uses: mxiamxia/aws-apm-action@main
53+
# Step 1: Prepare AWS MCP configuration and investigation prompt
54+
- name: Prepare Investigation Context
55+
id: prepare
56+
uses: mxiamxia/aws-apm-action@action-basedline
57+
with:
58+
bot_name: "@awsapm"
59+
cli_tool: "claude_code"
60+
61+
# Step 2: Execute investigation with Claude Code
62+
- name: Run Claude Investigation
63+
id: claude
64+
uses: anthropics/claude-code-base-action@beta
65+
with:
66+
use_bedrock: "true"
67+
model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
68+
prompt_file: ${{ steps.prepare.outputs.prompt_file }}
69+
mcp_config: ${{ steps.prepare.outputs.mcp_config_file }}
70+
allowed_tools: ${{ steps.prepare.outputs.allowed_tools }}
71+
72+
# Step 3: Post results back to GitHub issue/PR (reuse the same action)
73+
- name: Post Investigation Results
74+
if: always() # Run even if Claude step fails
75+
uses: mxiamxia/aws-apm-action@action-basedline
3576
with:
3677
bot_name: "@awsapm"
78+
cli_tool: "claude_code"
79+
comment_id: ${{ steps.prepare.outputs.awsapm_comment_id }}
80+
output_file: ${{ steps.claude.outputs.execution_file }}
81+
output_status: ${{ steps.claude.outputs.conclusion }}

0 commit comments

Comments
 (0)