Add Forgejo/GitHub Actions support (action.yml + CI context detection) #39

Closed
opened 2026-07-02 02:45:43 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-07-02 02:45:43 +00:00 (Migrated from codeberg.org)

WuMing currently reads CI context only from Woodpecker environment variables. To support Forgejo Actions and GitHub Actions as a native action, two changes are needed:

  1. Add action.yml at the repo root wrapping the published container image so consumers can reference WuMing via uses: marvin8/wuming@main.
  2. Add _detect_ci_context() to config.py that reads Woodpecker vars first and falls back to GITHUB_* vars (auto-injected by Forgejo/GitHub Actions runners) for repo identity, PR number, commit SHA, and Forgejo URL.

No changes to Woodpecker deployments — the Woodpecker path is detected first and takes priority.

WuMing currently reads CI context only from Woodpecker environment variables. To support Forgejo Actions and GitHub Actions as a native action, two changes are needed: 1. Add `action.yml` at the repo root wrapping the published container image so consumers can reference WuMing via `uses: marvin8/wuming@main`. 2. Add `_detect_ci_context()` to `config.py` that reads Woodpecker vars first and falls back to `GITHUB_*` vars (auto-injected by Forgejo/GitHub Actions runners) for repo identity, PR number, commit SHA, and Forgejo URL. No changes to Woodpecker deployments — the Woodpecker path is detected first and takes priority.
coding-agent-marvin8 commented 2026-07-02 02:45:51 +00:00 (Migrated from codeberg.org)

Plan of attack:

Key files: src/wuming/config.py, new action.yml, new tests/test_config_ci_context.py, docs.

Sequence:

  1. Add CIContext frozen dataclass (owner, name, pr_index, sha, forgejo_url) to config.py.
  2. Add _parse_pr_index_from_event() — reads path from WUMING_EVENT_PATH or GITHUB_EVENT_PATH, parses JSON, returns PR number string.
  3. Add _detect_ci_context() — Woodpecker vars (CI_REPO_OWNER present) → return immediately; else read GITHUB_* vars.
  4. Update load_config() to call _detect_ci_context() instead of reading CI_* vars directly.
  5. Write five tests covering: Woodpecker path, Actions path with event file, explicit WUMING_FORGEJO_URL override, WUMING_EVENT_PATH override, no CI vars.
  6. Add action.yml using docker://codeberg.org/marvin8/wuming:latest.
  7. Docs: new deploying-on-forgejo-actions.md, update index.md, mkdocs.yml, configuration.md, README.md, CLAUDE.md, Improvements.md.
Plan of attack: **Key files:** `src/wuming/config.py`, new `action.yml`, new `tests/test_config_ci_context.py`, docs. **Sequence:** 1. Add `CIContext` frozen dataclass (owner, name, pr_index, sha, forgejo_url) to `config.py`. 2. Add `_parse_pr_index_from_event()` — reads path from `WUMING_EVENT_PATH` or `GITHUB_EVENT_PATH`, parses JSON, returns PR number string. 3. Add `_detect_ci_context()` — Woodpecker vars (CI_REPO_OWNER present) → return immediately; else read GITHUB_* vars. 4. Update `load_config()` to call `_detect_ci_context()` instead of reading CI_* vars directly. 5. Write five tests covering: Woodpecker path, Actions path with event file, explicit WUMING_FORGEJO_URL override, WUMING_EVENT_PATH override, no CI vars. 6. Add `action.yml` using `docker://codeberg.org/marvin8/wuming:latest`. 7. Docs: new deploying-on-forgejo-actions.md, update index.md, mkdocs.yml, configuration.md, README.md, CLAUDE.md, Improvements.md.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/wuming#39
No description provided.