fix: pr-check platform detection via metadata API, allow fix/patch to main #331

Merged
jmiller merged 2 commits from hotfix/pr-check-metadata-platform into main 2026-07-04 19:36:04 +00:00
Owner

Why

This is the upstream fix for the platform template so the changes made directly in MokoGitea-Fork#724 aren't reverted on the next workflow sync. .mokogitea/workflows/pr-check.yml here is the source that gets pushed to all org repos.

Changes

1. Platform detection no longer reads .mokogitea/manifest.xml.
manifest.xml is no longer used — platform now comes from the MokoGitea metadata API (GET /api/v1/repos/{owner}/{repo}/metadata.platform, a public endpoint). The old PLATFORM=$(sed ... manifest.xml) aborted the Validate PR job under set -e on any repo without the file (e.g. generic Go/TS repos). New step:

API="${GITHUB_SERVER_URL:-https://git.mokoconsulting.tech}/api/v1/repos/${GITHUB_REPOSITORY}/metadata"
PLATFORM="$(curl -sf "$API" 2>/dev/null | python3 -c "import sys, json; print(json.load(sys.stdin).get('platform') or '')" 2>/dev/null || true)"
[ -z "$PLATFORM" ] && PLATFORM="generic"

Joomla/dolibarr detection is preserved (metadata returns joomla/dolibarr); generic repos fall back to generic.

2. Branch policy allows fix/*main and patch/*main.
The policy had drifted to fix/* → dev only, rejecting fix/patch PRs to main despite the documented policy. Now:

  • fix/*dev or main
  • patch/*dev, rc, or main

Notes

  • Verified: metadata API returns "platform": "go" for MokoGitea-Fork; YAML parses clean.
  • After merge, run workflow sync to propagate to all repos (the fork's local copy will be replaced by this version).
## Why This is the upstream fix for the platform template so the changes made directly in `MokoGitea-Fork#724` aren't reverted on the next workflow sync. `.mokogitea/workflows/pr-check.yml` here is the source that gets pushed to all org repos. ## Changes **1. Platform detection no longer reads `.mokogitea/manifest.xml`.** `manifest.xml` is no longer used — platform now comes from the MokoGitea **metadata API** (`GET /api/v1/repos/{owner}/{repo}/metadata` → `.platform`, a public endpoint). The old `PLATFORM=$(sed ... manifest.xml)` aborted the Validate PR job under `set -e` on any repo without the file (e.g. generic Go/TS repos). New step: ```bash API="${GITHUB_SERVER_URL:-https://git.mokoconsulting.tech}/api/v1/repos/${GITHUB_REPOSITORY}/metadata" PLATFORM="$(curl -sf "$API" 2>/dev/null | python3 -c "import sys, json; print(json.load(sys.stdin).get('platform') or '')" 2>/dev/null || true)" [ -z "$PLATFORM" ] && PLATFORM="generic" ``` Joomla/dolibarr detection is preserved (metadata returns `joomla`/`dolibarr`); generic repos fall back to `generic`. **2. Branch policy allows `fix/*` → `main` and `patch/*` → `main`.** The policy had drifted to `fix/* → dev` only, rejecting fix/patch PRs to main despite the documented policy. Now: - `fix/*` → `dev` or `main` - `patch/*` → `dev`, `rc`, or `main` ## Notes - Verified: metadata API returns `"platform": "go"` for MokoGitea-Fork; YAML parses clean. - After merge, run workflow sync to propagate to all repos (the fork's local copy will be replaced by this version).
jmiller added 1 commit 2026-07-04 19:19:32 +00:00
fix: pr-check platform detection via metadata API, allow fix/patch to main
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Failing after 6s
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 1s
Universal: PR Check / Validate PR (pull_request) Successful in 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 10s
Generic: Project CI / Lint & Validate (pull_request) Successful in 25s
Platform: mokocli CI / Gate 1: Code Quality (pull_request) Failing after 48s
Generic: Project CI / Tests (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: mokocli CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: mokocli CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: mokocli CI / CI Summary (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
9036d20898
Read the build platform from the MokoGitea metadata API instead of .mokogitea/manifest.xml, which is no longer used and caused the Detect platform step to abort under set -e when absent. Also allow fix/* and patch/* branches to target main per documented branch policy.
jmiller added 1 commit 2026-07-04 19:32:26 +00:00
fix: drop removed automation/ dir refs and dangling mcp submodule gitlinks
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Validate PR (pull_request) Successful in 9s
Universal: PR Check / Secret Scan (pull_request) Successful in 11s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 18s
Generic: Project CI / Lint & Validate (pull_request) Successful in 1m6s
Platform: mokocli CI / Gate 1: Code Quality (pull_request) Failing after 1m17s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Failing after 2s
Universal: Build & Release / Build & Release Pipeline (pull_request) Successful in 22s
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Successful in 6m14s
Generic: Project CI / Tests (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: mokocli CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: mokocli CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: mokocli CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: mokocli CI / CI Summary (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
3f956f5661
The automation/ directory was removed (bulk_sync.php moved to wrappers/, others deleted) but references remained, hard-failing Gate 1 phpcs and the post-merge sync. Drop automation/ from phpcs/phpstan config and repoint sync-on-merge to wrappers/bulk_sync.php. Also remove the dangling mcp/servers/mokogitea_api and mcp/servers/windows/mcp_windows gitlinks that had no .gitmodules entry and broke submodule init at checkout.
jmiller merged commit bba1cbc845 into main 2026-07-04 19:36:04 +00:00
jmiller deleted branch hotfix/pr-check-metadata-platform 2026-07-04 19:36:05 +00:00
Sign in to join this conversation.
No Reviewers
No labels
Priority -
Type -
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoCLI#331