Skip to content

Agent Android Bot

Agent Android Bot #3

name: Agent Android Bot
on:
workflow_dispatch:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
pull_request_review:
types: [submitted]
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
bot:
runs-on: ubuntu-latest
if: >-
github.event_name == 'workflow_dispatch' ||
(
contains(github.event.comment.body || github.event.review.body, '@android-agent') &&
!contains(github.event.comment.body || github.event.review.body, '/fix')
)
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22.18.0"
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Install agent-device
run: npm install -g agent-device
- name: Setup Android SDK
run: |
# Add SDK tools to PATH
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
echo "$ANDROID_HOME/emulator" >> $GITHUB_PATH
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
# Install SDK components
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install \
"system-images;android-35;google_apis;x86_64" \
"platform-tools" \
"platforms;android-35" \
"emulator"
- name: Create AVD and start emulator
run: |
# Create AVD with explicit home
export ANDROID_AVD_HOME="$HOME/.android/avd"
mkdir -p "$ANDROID_AVD_HOME"
echo "no" | avdmanager create avd \
-n "Android35" \
-k "system-images;android-35;google_apis;x86_64" \
--device "pixel_6" \
--force
# Verify AVD was created
ls -la "$ANDROID_AVD_HOME"
avdmanager list avd
# Start emulator in background
nohup emulator -avd Android35 \
-no-window -gpu swiftshader_indirect -noaudio -no-boot-anim \
-no-snapshot-save 2>&1 &
# Wait for emulator to boot
adb wait-for-device
timeout 120 bash -c 'while [[ "$(adb shell getprop sys.boot_completed 2>/dev/null)" != "1" ]]; do sleep 2; done'
adb devices
echo "Android emulator is ready"
- name: Run agent
uses: anthropics/claude-code-action@beta
env:
ANTHROPIC_BASE_URL: https://proxy.shopify.ai/vendors/anthropic
with:
model: claude-opus-4-6
trigger_phrase: "@android-agent"
anthropic_api_key: ${{ secrets.AI_PROXY_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
allowed_tools: "Read,Edit,Write,Glob,Grep,Bash(yarn:*),Bash(git:*),Bash(gh:*),Bash(node:*),Bash(npx:*),Bash(agent-device:*),Bash(adb:*),Bash(curl:*),Bash(grep:*),Bash(find:*),Bash(ls:*),Bash(cat:*),Bash(mkdir:*),Bash(kill:*),Bash(lsof:*)"
custom_instructions: |
You are a helpful assistant for the flash-list project with an Android emulator running.
Do whatever is asked — review PRs, answer questions, suggest fixes, or make code changes.
You can test on the Android emulator using agent-device with --platform android.
The emulator device is named "Android35".
Use the available skills when relevant (fix-github-issue, raise-pr, review-and-test, triage-issue).
If making code changes, run `yarn build && yarn test --forceExit && yarn type-check && yarn lint` to verify.