|
| 1 | +# acpx-gh-action |
| 2 | + |
| 3 | +`acpx-gh-action` scaffolds an ACPX-powered GitHub Actions workflow plus a matching `flows/*.ts` file. |
| 4 | + |
| 5 | +The default scaffold listens for a specific GitHub issue label, runs a chosen coding agent against that issue inside the repository checkout, and opens a PR if the run produces changes. |
| 6 | + |
| 7 | +This repo also now ships a reusable composite action at `.github/actions/run-acpx-flow`, so generated workflows can reference a real `uses:` target instead of inlining the `acpx` bootstrap. |
| 8 | + |
| 9 | +## What it generates |
| 10 | + |
| 11 | +- `.github/workflows/<flow-name>.yml` |
| 12 | +- `flows/<flow-name>.ts` |
| 13 | + |
| 14 | +The scaffold source lives in Handlebars templates: |
| 15 | + |
| 16 | +- `templates/default/workflow.yml.hbs` |
| 17 | +- `templates/default/flow.ts.hbs` |
| 18 | + |
| 19 | +## Usage |
| 20 | + |
| 21 | +```bash |
| 22 | +pnpm install |
| 23 | +pnpm run build |
| 24 | +node dist/cli.js init |
| 25 | +``` |
| 26 | + |
| 27 | +## CI And Publishing |
| 28 | + |
| 29 | +This repo includes: |
| 30 | + |
| 31 | +- `.github/workflows/ci.yml` to run `pnpm install --frozen-lockfile`, `pnpm run build`, and `pnpm run test` |
| 32 | +- `.github/workflows/publish.yml` to publish to npm from GitHub Actions using trusted publishing |
| 33 | + |
| 34 | +To use secure npm publishing, configure npm to trust this repository and the `.github/workflows/publish.yml` workflow as a trusted publisher. With npm trusted publishing on GitHub-hosted runners, OIDC is used instead of an `NPM_TOKEN`, and provenance is generated automatically. |
| 35 | + |
| 36 | +The CLI prompts for: |
| 37 | + |
| 38 | +- flow name |
| 39 | +- workflow display name |
| 40 | +- reusable action reference |
| 41 | +- coding agent from the current `acpx` built-in list |
| 42 | +- runner setup command for `acpx` plus the chosen agent |
| 43 | +- primary auth secret env var to expose |
| 44 | +- GitHub issue label to respond to |
| 45 | +- extra GitHub secret names to expose as environment variables |
| 46 | +- target repository directory |
| 47 | + |
| 48 | +## Generated workflow behavior |
| 49 | + |
| 50 | +The scaffolded workflow: |
| 51 | + |
| 52 | +1. Triggers on `issues.opened` and `issues.labeled` |
| 53 | +2. Runs only when the configured label is present on the issue |
| 54 | +3. Checks out the target repository |
| 55 | +4. Calls a reusable action via `uses: <your-action-ref>` |
| 56 | +5. Runs `acpx --approve-all flow run flows/<flow>.ts` |
| 57 | +6. Opens a PR and comments on the issue when code changes were produced |
| 58 | + |
| 59 | +Example: |
| 60 | + |
| 61 | +```yaml |
| 62 | +- name: Run Codex Review |
| 63 | + uses: your-org/acpx-gh-action/.github/actions/run-acpx-flow@main |
| 64 | + with: |
| 65 | + flow-path: flows/issue-label-agent.ts |
| 66 | + default-agent: codex |
| 67 | + input-json: '{"repo":"${{ github.repository }}","issueNumber":${{ github.event.issue.number }}}' |
| 68 | + setup-command: npm install -g acpx @openai/codex |
| 69 | + github-token: ${{ github.token }} |
| 70 | + agent-auth-name: OPENAI_API_KEY |
| 71 | + agent-auth-value: ${{ secrets.OPENAI_API_KEY }} |
| 72 | +``` |
| 73 | +
|
| 74 | +## Secrets |
| 75 | +
|
| 76 | +Known default auth secret suggestions: |
| 77 | +
|
| 78 | +- `codex`: `OPENAI_API_KEY` |
| 79 | +- `claude`: `ANTHROPIC_API_KEY` |
| 80 | +- `gemini`: `GEMINI_API_KEY` |
| 81 | + |
| 82 | +Other agents vary, so the CLI lets you override the primary auth env var and setup command directly. Any extra secret names entered in the CLI are added to the workflow `env` block as `${{ secrets.NAME }}`. |
0 commit comments