Automating Forgejo

Good Forgejo automation combines a scriptable CLI, workflow runners, and explicit operational boundaries.

CLI

What this solves

You need repeatable Forgejo administration or release tasks that can run from a shell or CI job.

Best fit

  • Repository provisioning
  • Release jobs
  • CI troubleshooting
  • Migration validation

How to think about it

Start with the smallest repeatable task and make the inputs explicit: repository, branch, token scope, output format, and failure behavior. Once the script is boring locally, move it into Actions or a scheduled operational job with the same assumptions documented.

Script-friendly pattern

set -euo pipefail
repo="org/project"

fj issue list --repo "$repo" --json number,title,state
fj run list --repo "$repo" --json id,status,conclusion
fj api "repos/$repo/releases"

Practical path

  1. 01 Start with fj JSON output for local scripts.
  2. 02 Move repeated jobs into Forgejo Actions.
  3. 03 Keep secrets, tokens, and runner labels documented before broad rollout.

When to choose another path

Prefer JSON output for scripts and human output for local use.

Rotate tokens used by automation and keep their ownership clear.

Make destructive operations require an explicit repository or release id.

Next resources

Related reading