Skip to content

Commit bf3ff79

Browse files
committed
refactor: move .github/scripts to .github/automation and add Dockerfile
Consolidate all agent automation assets (scripts, prompts, Dockerfile) under .github/automation/ for a single home for AI-powered workflows. - Rename .github/scripts/ -> .github/automation/ - Add Dockerfile for AgentCore Harness PR reviewer container - Add README documenting the automation directory - Update all workflow and action references to new paths
1 parent a778fb5 commit bf3ff79

15 files changed

Lines changed: 81 additions & 5 deletions

File tree

.github/actions/strands-action/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ runs:
159159
SYSTEM_PROMPT: ${{ inputs.system_prompt }}
160160
MCP_SERVERS: ${{ inputs.mcp_servers }}
161161
STRANDS_PROMPT: ${{ inputs.prompt }}
162-
PYTHONPATH: ${{ github.action_path }}:${{ github.workspace }}/.github/scripts/python
162+
PYTHONPATH: ${{ github.action_path }}:${{ github.workspace }}/.github/automation/python
163163
VIRTUAL_ENV: ${{ github.action_path }}/.venv
164164
run: |
165165
if [ -f "${{ github.action_path }}/custom_agent_runner.py" ]; then
166166
"${{ github.action_path }}/.venv/bin/python" "${{ github.action_path }}/custom_agent_runner.py"
167167
else
168-
"${{ github.action_path }}/.venv/bin/python" "${{ github.workspace }}/.github/scripts/python/agent_runner.py"
168+
"${{ github.action_path }}/.venv/bin/python" "${{ github.workspace }}/.github/automation/python/agent_runner.py"
169169
fi

.github/automation/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM public.ecr.aws/docker/library/python:3.12-slim
2+
3+
# Install system dependencies
4+
RUN apt-get update && apt-get install -y \
5+
git \
6+
curl \
7+
jq \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
# Install GitHub CLI
11+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
12+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
13+
> /etc/apt/sources.list.d/github-cli.list \
14+
&& apt-get update \
15+
&& apt-get install -y gh \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# Tokens are passed as build args only — not stored in env vars
19+
ARG CLONE_TOKEN
20+
ARG GITHUB_TOKEN
21+
22+
# Configure git to use clone token for HTTPS clones
23+
RUN git config --global url."https://${CLONE_TOKEN}@github.com/".insteadOf "https://github.com/"
24+
25+
# Persist gh CLI auth so GITHUB_TOKEN doesn't need to be in the environment
26+
RUN mkdir -p /root/.config/gh \
27+
&& echo "github.com:" > /root/.config/gh/hosts.yml \
28+
&& echo " oauth_token: ${GITHUB_TOKEN}" >> /root/.config/gh/hosts.yml \
29+
&& echo " user: agentcore-cli-automation" >> /root/.config/gh/hosts.yml \
30+
&& echo " git_protocol: https" >> /root/.config/gh/hosts.yml
31+
32+
WORKDIR /opt/workspace

.github/automation/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Agent Automation
2+
3+
Infrastructure and scripts for AI-powered automation in the agentcore-cli repo.
4+
5+
## Structure
6+
7+
```
8+
automation/
9+
├── Dockerfile # Container image for AgentCore Harness (PR reviewer)
10+
├── javascript/ # GitHub Actions helper scripts
11+
│ └── process-inputs.cjs # Input processing for /strands command workflow
12+
├── prompts/ # Prompt templates for harness invocations
13+
│ ├── system.md # System prompt (workspace context)
14+
│ └── review.md # PR review task prompt
15+
└── python/ # Python scripts
16+
├── harness_review.py # Invokes AgentCore Harness to review PRs
17+
├── agent_runner.py # Strands Agent runner for GitHub Actions
18+
├── github_tools.py # GitHub API tools for Strands Agents
19+
├── handoff_to_user.py # Agent-to-user handoff tool
20+
├── notebook.py # Notebook management tool
21+
└── str_replace_based_edit_tool.py # File editing tool
22+
```
23+
24+
## Harness PR Reviewer
25+
26+
The Dockerfile builds a container image used by [AgentCore Harness](https://docs.aws.amazon.com/bedrock/latest/userguide/agentcore.html) to review pull requests. The container includes `git`, `gh` CLI, and is configured with GitHub credentials at build time (tokens are baked into git config and gh auth, not exposed as env vars).
27+
28+
The review workflow (`.github/workflows/pr-ai-review.yml`) triggers on PR open/reopen:
29+
1. Checks the PR author is authorized (team membership or write access)
30+
2. Assumes an AWS role via OIDC
31+
3. Runs `harness_review.py` which signs a request with SigV4 and streams the harness response
32+
33+
### Building the container
34+
35+
```bash
36+
finch build \
37+
--build-arg CLONE_TOKEN=<pat-for-cloning> \
38+
--build-arg GITHUB_TOKEN=<pat-for-gh-api> \
39+
-t pr-reviewer .github/automation/
40+
```
41+
42+
## Strands Agent
43+
44+
The `agent_runner.py` script powers the `/strands` slash command workflow. It loads tools (GitHub, notebook, editor, MCP servers) and runs a Strands Agent with the configured model and prompts. See `.github/workflows/strands-command.yml`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)