Use Droid Exec in GitHub Actions when you want Factory to run a one-shot task from CI: review a pull request, refresh generated docs, scan for security risks, or run any repeatable repository workflow. Use the base scaffold once, then swap in the task-specific snippet that matches your workflow.Documentation Index
Fetch the complete documentation index at: https://factory-docs-academy-content-candidates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before adding Droid Exec to a workflow:- Generate a Factory API key from Factory Settings → API Keys.
- Add it to your repository secrets as
FACTORY_API_KEYunder Settings → Secrets and variables → Actions. - Decide the minimum autonomy level the workflow needs. Most CI workflows should start with
--auto lowand only use broader permissions when the task truly requires them.
Base workflow scaffold
Every GitHub Actions workflow using Droid Exec follows the same shape: check out the repository, install the Droid CLI, passFACTORY_API_KEY, and run droid exec with a scoped prompt.
permissions and the autonomy level only for workflows that need to write files, create pull requests, or open issues.
Task snippets
Keep the checkout andSetup Droid CLI steps from the scaffold, then replace the final Run Droid Exec step with the relevant snippet. Also update the workflow trigger and job permissions as shown in the customization table below.
What to customize
| Workflow | Trigger | Job permissions | Notes |
|---|---|---|---|
| PR review and fix | pull_request with opened, synchronize, reopened, ready_for_review | contents: write, pull-requests: write | Use only for trusted repositories where the Actions token may push to the source branch. |
| Scheduled maintenance | schedule plus workflow_dispatch | contents: write, pull-requests: write | Good for recurring docs, test, or lightweight maintenance PRs. |
| Security scan | schedule plus workflow_dispatch | contents: read, issues: write | Creates an issue when Droid writes actionable findings. |
For a maintained review workflow with inline comments, review depth, security
review, and scheduled scans, use the Automated Code Review
guide.
Prompt design for CI
CI prompts should be durable enough to run without a human in the loop.- Name the input: tell Droid whether to inspect a diff file, changed files, the whole repository, or a prompt file.
- Constrain writes: say whether Droid may edit files, create reports, open issues, or only print findings.
- Define success: request a specific artifact such as
review.md,maintenance-summary.md, orsecurity-report.md. - Exclude low-value work: tell Droid not to make stylistic rewrites unless the workflow exists for cleanup.
- Start read-only: use no
--autoflag for analysis-only tasks; use--auto lowwhen the workflow needs safe file operations.
