-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
157 lines (143 loc) · 6.18 KB
/
action.yml
File metadata and controls
157 lines (143 loc) · 6.18 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: "Application Observability for AWS Action"
description: "This curated Application Observability Github action provides Agentic AI driven investigation and resolution, using live production telemetry data."
branding:
icon: "cloud"
color: "orange"
inputs:
bot_name:
description: "The bot name to respond to in comments (e.g., @awsapm)"
required: false
default: "@awsapm"
target_branch:
description: "The branch to merge PRs into (defaults to repository default branch)"
required: false
branch_prefix:
description: "Prefix for branches created by the action (e.g., 'awsapm/', 'awsapm-')"
required: false
default: "awsapm/"
allowed_non_write_users:
description: "Comma-separated list of GitHub usernames allowed to use this action even without write access. Empty string (default) means only users with write/admin access can use it."
required: false
default: ""
github_token:
description: "GitHub token to use for API calls. If not provided, uses the default GitHub Actions token."
required: false
default: ${{ github.token }}
custom_prompt:
description: "Custom instructions to guide the AI agent's analysis and actions"
required: false
default: ""
enable_cloudwatch_mcp:
description: "Enable CloudWatch MCP server for metrics, alarms, and log insights"
required: false
default: "true"
test_mode:
description: "Enable integration test mode (internal use only)"
required: false
default: "false"
outputs:
execution_file:
description: "Path to the Amazon Q Developer CLI execution output file"
value: ${{ steps.aws-apm-cli.outputs.execution_file }}
branch_name:
description: "The branch created by Application observability for AWS Action for this execution"
value: ${{ steps.init.outputs.AWSAPM_BRANCH }}
github_token:
description: "The GitHub token used by the action"
value: ${{ steps.init.outputs.GITHUB_TOKEN }}
runs:
using: "composite"
steps:
- name: Validate test mode usage
if: inputs.test_mode == 'true'
shell: bash
run: |
if [[ "${{ github.repository }}" != "aws-actions/application-observability-for-aws" || "${{ github.ref_name }}" != "main" ]]; then
echo "::error::test_mode can only be used from the aws-actions/application-observability-for-aws repository main branch"
exit 1
fi
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies
shell: bash
run: |
cd ${GITHUB_ACTION_PATH}
npm install
- name: Init action
id: init
shell: bash
run: |
node ${GITHUB_ACTION_PATH}/src/init.js
env:
CUSTOM_PROMPT: ${{ inputs.custom_prompt }}
BOT_NAME: ${{ inputs.bot_name }}
TARGET_BRANCH: ${{ inputs.target_branch }}
BRANCH_PREFIX: ${{ inputs.branch_prefix }}
OVERRIDE_GITHUB_TOKEN: ${{ inputs.github_token }}
ALLOWED_NON_WRITE_USERS: ${{ inputs.allowed_non_write_users }}
GITHUB_RUN_ID: ${{ github.run_id }}
DEFAULT_WORKFLOW_TOKEN: ${{ github.token }}
TRACING_MODE: ${{ inputs.tracing_mode }}
TEST_MODE: ${{ inputs.test_mode }}
- name: Install CLI Tools
if: steps.init.outputs.contains_trigger == 'true'
shell: bash
run: |
set -e # Exit immediately if any command fails
# Install uv/uvx for MCP server execution
echo "Installing uv package manager for MCP server support..."
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
# Verify uvx installation
if ! command -v uvx &> /dev/null; then
echo "::error::uvx installation failed - Amazon Q MCP tools will not work"
exit 1
fi
echo "uvx installed successfully"
uvx --version
# Install Amazon Q Developer CLI
echo "Installing Amazon Q Developer CLI..."
sudo apt-get update
curl -L -o amazon-q.deb https://desktop-release.q.us-east-1.amazonaws.com/1.19.4/amazon-q.deb
sudo apt-get install -y --fix-missing ./amazon-q.deb || sudo apt-get install -y -f
# Verify Amazon Q CLI installation
if ! command -v q &> /dev/null; then
echo "::error::Amazon Q CLI installation failed - q command not found in PATH"
exit 1
fi
echo "Amazon Q CLI installed successfully"
q --version
- name: Run Application observability for AWS Investigation
id: aws-apm-cli
if: steps.init.outputs.contains_trigger == 'true'
shell: bash
run: |
cd ${GITHUB_ACTION_PATH}
node src/execute.js
env:
GITHUB_TOKEN: ${{ steps.init.outputs.GITHUB_TOKEN }}
ENABLE_CLOUDWATCH_MCP: ${{ inputs.enable_cloudwatch_mcp }}
INPUT_PROMPT_FILE: ${{ runner.temp }}/awsapm-prompts/awsapm-prompt.txt
- name: Update comment with results
if: steps.init.outputs.contains_trigger == 'true' && steps.init.outputs.awsapm_comment_id && always()
shell: bash
run: |
cd ${GITHUB_ACTION_PATH}
node src/post-result.js
env:
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
AWSAPM_COMMENT_ID: ${{ steps.init.outputs.awsapm_comment_id }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_TOKEN: ${{ steps.init.outputs.GITHUB_TOKEN }}
GITHUB_EVENT_NAME: ${{ github.event_name }}
TRIGGER_COMMENT_ID: ${{ github.event.comment.id }}
AWSAPM_BRANCH: ${{ steps.init.outputs.AWSAPM_BRANCH }}
IS_PR: ${{ github.event.issue.pull_request != null || github.event_name == 'pull_request_review_comment' }}
TARGET_BRANCH: ${{ steps.init.outputs.TARGET_BRANCH }}
AWSAPM_SUCCESS: ${{ steps.aws-apm-cli.outputs.conclusion == 'success' }}
OUTPUT_FILE: ${{ steps.aws-apm-cli.outputs.execution_file || '' }}
TRIGGER_USERNAME: ${{ github.event.comment.user.login || github.event.issue.user.login || github.event.pull_request.user.login || github.event.sender.login || github.triggering_actor || github.actor || '' }}
INIT_SUCCESS: ${{ steps.init.outcome == 'success' }}