Action that runs Pi agent in Forgejo CI when commenting with a reference to an llm bot
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Renovate [bot] 33fa039b05
All checks were successful
release.yaml / Generate next release tag (push) Successful in 4s
ci(deps): update ci dependencies (#365)
2026-10-24 03:21:38 +00:00
.devcontainer ci(deps): update ci dependencies (#364) 2026-10-23 05:44:54 +00:00
.forgejo ci(deps): update ci dependencies (#365) 2026-10-24 03:21:38 +00:00
.vitest test(integration): add integration tests against a real forgejo instance (#266) 2026-09-10 20:16:25 +00:00
examples/event_payloads feat: add close and create issue tools (#19) 2026-06-18 18:32:35 +00:00
src ci: add unit test workflow (#280) 2026-09-12 13:44:14 +00:00
.gitignore Revert "test(integration): add integration tests against a real forgejo instance" 2026-09-08 21:06:01 +00:00
.prettierignore Revert "test(integration): add integration tests against a real forgejo instance" 2026-09-08 21:06:01 +00:00
.prettierrc.json docs: add README.md and AGENTS.md (#49) 2026-06-20 14:20:10 +00:00
.releaserc.json feat: enable forgejo releases (#229) 2026-08-27 09:49:54 +00:00
.renovaterc.jsonc chore: configure renovate (#325) 2026-10-04 10:41:37 +00:00
.yamllint.yaml fix: replace tag in action.yaml on release 2026-06-17 18:33:54 +02:00
action.yaml chore(release): v1.11.18 2026-10-21 03:20:02 +00:00
AGENTS.md ci: add unit test workflow (#280) 2026-09-12 13:44:14 +00:00
biome.jsonc chore(deps): update dependency @biomejs/biome to v2.5.15 (#321) 2026-10-04 03:09:24 +00:00
LICENSE docs: add README.md and AGENTS.md (#49) 2026-06-20 14:20:10 +00:00
package.json fix(deps): update dependency typebox to v1.4.2 (#361) 2026-10-21 03:08:58 +00:00
pnpm-lock.yaml fix(deps): update dependency typebox to v1.4.2 (#361) 2026-10-21 03:08:58 +00:00
pnpm-workspace.yaml fix(deps): update dependency @earendil-works/pi-coding-agent to v0.85.0 (#261) 2026-09-08 16:00:39 +00:00
README.md feat: give context on previous reviews for successive review requests (#263) 2026-09-12 12:45:44 +00:00
rolldown.config.ts feat: refactor into a composite action (#12) 2026-06-18 11:48:11 +00:00
sea.json fix: migrate to new projects org (#86) 2026-06-24 16:59:01 +00:00
tsconfig.json feat: initial commit 2026-06-16 23:43:41 +02:00

forgejo-agent

forgejo-agent is a composite GitHub Action (Forgejo-compatible) that runs an AI coding agent in response to:

  • Issue comments — when someone mentions the agent's username in a comment
  • Issues opened — when a new issue is opened mentioning the agent
  • Pull requests opened — when a PR is opened mentioning the agent
  • Pull request review requests — when the agent is assigned as a reviewer

The agent uses the Pi Coding Agent SDK to reason about code, make changes, and interact with the repository through custom Forgejo API tools.

Features

  • Responds to issue and PR comments mentioning the agent's username
  • Reads issue/PR content and conversation history
  • Makes code changes via git commits and pushes
  • Creates, closes, and comments on issues
  • Creates pull requests when working on the default branch
  • Supports pull request review with findings submission
  • Gives the agent context on its previous reviews when re-assigned as reviewer

Quick Start

Add this action to your Forgejo workflow:

- uses: projects/forgejo-agent@v1
  with:
    # Create a token for the llm-bot user with repository:write and issue:write
    # permissions.
    auth-token: ${{ secrets.AGENT_TOKEN }}
    # I recommend creating a separate user to restrict permissions for the agent.
    auth-username: llm-bot
    git-author: llm-bot
    git-email: [email protected]
Input Description Required
auth-token Forgejo API token Yes
auth-username Username the agent responds to Yes
git-author Git author name for commits Yes
git-email Git email for commits Yes

Building from Source

# Install the dependencies and build.
pnpm install
pnpm build

# Run the final executable.
./dist/forgejo-agent

The build produces a single self-contained binary using Node.js SEA (Single Executable Application).

Testing

Unit tests mock the network and run anywhere:

pnpm test:unit

Integration tests run against a real Forgejo instance that is started by the dev container (.devcontainer/docker-compose.yaml, reachable at http://forgejo:3000), so they must run from the workspace container:

pnpm test:integration

Project Structure

src/
├── main.ts       # Agent session entry point
├── git.ts        # Git repository cloning/checkout
├── forgejo/      # Forgejo API client
│   ├── fetch.ts  # HTTP client
│   └── index.ts  # API endpoint functions
├── context.ts    # Runtime context from environment
├── prompt.ts     # Prompt builder for the agent
├── tools.ts      # Custom Forgejo tools
├── schemas.ts    # TypeBox schemas
└── test/         # Unit and integration tests
examples/
└── event_payloads/  # Sample webhook payloads

License

MIT