171 lines
7.2 KiB
YAML
171 lines
7.2 KiB
YAML
name: "Docubot"
|
|
description: "Helps Warp engineers identify PRs that need documentation updates in GitBook"
|
|
inputs:
|
|
prompt:
|
|
description: "Prompt to send to Warp"
|
|
required: true
|
|
warp_api_key:
|
|
description: "Warp API key"
|
|
required: true
|
|
warp_channel:
|
|
description: "Warp release channel (e.g., dev, preview, stable)"
|
|
required: false
|
|
default: "dev"
|
|
profile_id:
|
|
description: "Warp profile ID"
|
|
required: false
|
|
github_token:
|
|
description: "GitHub token for cloning private repositories"
|
|
required: false
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Setup Warp CLI
|
|
uses: ./.github/actions/setup_warp_cli
|
|
with:
|
|
warp_channel: ${{ inputs.warp_channel }}
|
|
- name: Clone Warp GitBook repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
repository: warpdotdev/gitbook
|
|
token: ${{ inputs.github_token }}
|
|
path: gitbook
|
|
- name: Create prompt file
|
|
shell: bash
|
|
# TODO: use sdk (python or typescript) for this
|
|
run: |
|
|
set -euo pipefail
|
|
envsubst < .github/actions/docubot/prompt.txt > prompt.output.txt
|
|
env:
|
|
# GitHub Repository Context
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
|
|
GITHUB_REPOSITORY_OWNER_ID: ${{ github.repository_owner_id }}
|
|
GITHUB_REPOSITORY_ID: ${{ github.repository_id }}
|
|
GITHUB_REPOSITORY_URL: ${{ github.repositoryUrl }}
|
|
|
|
# GitHub Event Context
|
|
GITHUB_EVENT_NAME: ${{ github.event_name }}
|
|
GITHUB_EVENT_PATH: ${{ github.event_path }}
|
|
GITHUB_EVENT_ACTION: ${{ github.event.action }}
|
|
|
|
# GitHub Workflow Context
|
|
GITHUB_WORKFLOW: ${{ github.workflow }}
|
|
GITHUB_WORKFLOW_REF: ${{ github.workflow_ref }}
|
|
GITHUB_WORKFLOW_SHA: ${{ github.workflow_sha }}
|
|
GITHUB_JOB: ${{ github.job }}
|
|
GITHUB_RUN_ID: ${{ github.run_id }}
|
|
GITHUB_RUN_NUMBER: ${{ github.run_number }}
|
|
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
|
|
|
|
# GitHub Actor Context
|
|
GITHUB_ACTOR: ${{ github.actor }}
|
|
GITHUB_ACTOR_ID: ${{ github.actor_id }}
|
|
GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }}
|
|
|
|
# GitHub Git Context
|
|
GITHUB_REF: ${{ github.ref }}
|
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
GITHUB_REF_PROTECTED: ${{ github.ref_protected }}
|
|
GITHUB_REF_TYPE: ${{ github.ref_type }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
GITHUB_HEAD_REF: ${{ github.head_ref }}
|
|
GITHUB_BASE_REF: ${{ github.base_ref }}
|
|
|
|
# Issue/PR Context
|
|
PR_OR_ISSUE_TITLE: ${{ github.event.issue.title || github.event.pull_request.title }}
|
|
PR_OR_ISSUE_BODY: ${{ github.event.issue.body || github.event.pull_request.body }}
|
|
PR_OR_ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
|
|
PR_OR_ISSUE_URL: ${{ github.event.issue.html_url || github.event.pull_request.html_url }}
|
|
PR_OR_ISSUE_STATE: ${{ github.event.issue.state || github.event.pull_request.state }}
|
|
PR_OR_ISSUE_CREATED_AT: ${{ github.event.issue.created_at || github.event.pull_request.created_at }}
|
|
PR_OR_ISSUE_UPDATED_AT: ${{ github.event.issue.updated_at || github.event.pull_request.updated_at }}
|
|
PR_OR_ISSUE_USER_LOGIN: ${{ github.event.issue.user.login || github.event.pull_request.user.login }}
|
|
PR_OR_ISSUE_USER_ID: ${{ github.event.issue.user.id || github.event.pull_request.user.id }}
|
|
PR_OR_ISSUE_ASSIGNEES: ${{ toJson(github.event.issue.assignees) || toJson(github.event.pull_request.assignees) }}
|
|
PR_OR_ISSUE_LABELS: ${{ toJson(github.event.issue.labels) || toJson(github.event.pull_request.labels) }}
|
|
|
|
# Pull Request Specific Context
|
|
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
|
PR_HEAD_REPO_FULL_NAME: ${{ github.event.pull_request.head.repo.full_name }}
|
|
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
PR_BASE_REPO_FULL_NAME: ${{ github.event.pull_request.base.repo.full_name }}
|
|
PR_DRAFT: ${{ github.event.pull_request.draft }}
|
|
PR_MERGED: ${{ github.event.pull_request.merged }}
|
|
PR_MERGEABLE: ${{ github.event.pull_request.mergeable }}
|
|
PR_MERGEABLE_STATE: ${{ github.event.pull_request.mergeable_state }}
|
|
PR_COMMITS: ${{ github.event.pull_request.commits }}
|
|
PR_ADDITIONS: ${{ github.event.pull_request.additions }}
|
|
PR_DELETIONS: ${{ github.event.pull_request.deletions }}
|
|
PR_CHANGED_FILES: ${{ github.event.pull_request.changed_files }}
|
|
|
|
# Issue Specific Context
|
|
ISSUE_CLOSED_AT: ${{ github.event.issue.closed_at }}
|
|
ISSUE_MILESTONE: ${{ toJson(github.event.issue.milestone) }}
|
|
|
|
# Comment Context (for issue_comment events)
|
|
COMMENT_BODY: ${{ github.event.comment.body }}
|
|
COMMENT_USER_LOGIN: ${{ github.event.comment.user.login }}
|
|
COMMENT_USER_ID: ${{ github.event.comment.user.id }}
|
|
COMMENT_CREATED_AT: ${{ github.event.comment.created_at }}
|
|
COMMENT_UPDATED_AT: ${{ github.event.comment.updated_at }}
|
|
COMMENT_HTML_URL: ${{ github.event.comment.html_url }}
|
|
|
|
# Documentation Repository Context
|
|
GITBOOK_PATH: ${{ format('{0}/gitbook', github.workspace) }}
|
|
|
|
- name: Configure git identity
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "Warp Agent"
|
|
git config user.email "agent@warp.dev"
|
|
|
|
- name: Run Warp agent
|
|
shell: bash
|
|
env:
|
|
WARP_API_KEY: ${{ inputs.warp_api_key }}
|
|
GH_TOKEN: ${{ inputs.github_token }}
|
|
PROFILE_ID: ${{ inputs.profile_id }}
|
|
run: |
|
|
set -euo pipefail
|
|
# Determine the CLI command name based on channel suffix
|
|
case "${{ inputs.warp_channel }}" in
|
|
stable|stable_release|"") suffix="" ;;
|
|
preview|preview_release) suffix="-preview" ;;
|
|
dev|dev_release) suffix="-dev" ;;
|
|
local) suffix="-local" ;;
|
|
integration|integration_test) suffix="-integration" ;;
|
|
*) suffix="" ;;
|
|
esac
|
|
cmd="warp-cli${suffix}"
|
|
|
|
# Basic check the binary exists
|
|
if ! command -v "$cmd" >/dev/null 2>&1; then
|
|
echo "Error: $cmd not found on PATH after installation"
|
|
exit 1
|
|
fi
|
|
|
|
# Execute the agent run
|
|
"$cmd" agent run \
|
|
--prompt "$(cat prompt.output.txt)" \
|
|
--api-key "$WARP_API_KEY" \
|
|
--cwd "$GITHUB_WORKSPACE" \
|
|
${PROFILE_ID:+--profile "$PROFILE_ID"}
|
|
- name: Upload Warp logs
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: warp-logs.log
|
|
path: /home/runner/.local/state/warp-terminal-dev/warp_dev.log
|
|
if-no-files-found: ignore
|
|
- name: Upload Warp prompt
|
|
if: ${{ always() }}
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: prompt.output.txt
|
|
path: prompt.output.txt
|
|
if-no-files-found: ignore
|