68 Commits

Author SHA1 Message Date
jmiller 5505a305cc ci(templates): AND Template- guard into remaining platform release/publish/sync workflows
Universal: Auto Version Bump / Version Bump (push) Successful in 21s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 21s
Universal: Auto-Assign / Assign unassigned issues and PRs (pull_request_target) Successful in 3s
Universal: Changelog Validation / Validate CHANGELOG.md (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Successful in 28s
MCP: Copilot Agent / Run Copilot Coding Agent (pull_request) Failing after 5s
Universal: PR Check / Branch Policy (pull_request) Successful in 3s
Universal: PR Check / Secret Scan (pull_request) Successful in 8s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
MCP: Standards Compliance / Secret Scanning (pull_request) Successful in 6s
Universal: CodeQL Analysis / Analyze (actions) (pull_request) Failing after 1m7s
MCP: Standards Compliance / License Header Validation (pull_request) Successful in 6s
Universal: CodeQL Analysis / Analyze (javascript) (pull_request) Failing after 1m8s
MCP: Standards Compliance / Repository Structure Validation (pull_request) Failing after 6s
MCP: Standards Compliance / Coding Standards Check (pull_request) Failing after 7s
MCP: Standards Compliance / Workflow Configuration Check (pull_request) Failing after 6s
MCP: Standards Compliance / Documentation Quality Check (pull_request) Successful in 6s
MCP: Standards Compliance / README Completeness Check (pull_request) Failing after 5s
MCP: Standards Compliance / Git Repository Hygiene (pull_request) Successful in 7s
MCP: Standards Compliance / Line Length Check (pull_request) Failing after 7s
MCP: Standards Compliance / Script Integrity Validation (pull_request) Successful in 9s
MCP: Standards Compliance / File Naming Standards (pull_request) Successful in 6s
MCP: Standards Compliance / Insecure Code Pattern Detection (pull_request) Successful in 6s
MCP: Standards Compliance / Version Consistency Check (pull_request) Successful in 1m22s
MCP: Standards Compliance / Dead Code Detection (pull_request) Successful in 8s
MCP: Standards Compliance / File Size Limits (pull_request) Successful in 6s
MCP: Standards Compliance / Binary File Detection (pull_request) Successful in 7s
MCP: Standards Compliance / TODO/FIXME Tracking (pull_request) Successful in 5s
MCP: Standards Compliance / Code Complexity Analysis (pull_request) Successful in 1m25s
MCP: Standards Compliance / Code Duplication Detection (pull_request) Successful in 1m30s
MCP: Standards Compliance / Broken Link Detection (pull_request) Successful in 7s
MCP: Standards Compliance / API Documentation Coverage (pull_request) Successful in 6s
MCP: Standards Compliance / Accessibility Check (pull_request) Successful in 6s
MCP: Standards Compliance / Performance Metrics (pull_request) Successful in 6s
MCP: Standards Compliance / Unused Dependencies Check (pull_request) Successful in 1m22s
MCP: Standards Compliance / Dependency Vulnerability Scanning (pull_request) Successful in 1m26s
MCP: Standards Compliance / Terraform Configuration Validation (pull_request) Successful in 17s
MCP: Standards Compliance / Enterprise Readiness Check (pull_request) Successful in 1m13s
MCP: Standards Compliance / Repository Health Check (pull_request) Successful in 1m15s
Branch Cleanup / Delete merged branch (pull_request) Has been skipped
Universal: Workflow Sync Trigger / Sync workflows to live repos (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Generic: Project CI / Tests (pull_request) Has been cancelled
Universal: CodeQL Analysis / Security Scan 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
MCP: Standards Compliance / Compliance Summary (pull_request) Has been cancelled
2026-07-05 20:40:06 +00:00
jmiller ab9112c234 ci(templates): gate build/CI/release/version workflows off template repos + normalize mokocli refs
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 26s
- Add 'skip on Template-*' guards to build/CI/release/version workflows so they
  don't run on the template repo itself (only on repos created from it).
- Smart-gate sync workflows to run ONLY on Template-* sources (so platform
  templates still propagate, but regular repos don't trigger sync-out).
- Normalize mokocli->MokoCLI repo/clone URLs, drop stale mokoconsulting-tech
  org slug on the git host, and mokoplatform/moko-platform->mokocli.
  (/opt/mokocli + /tmp/mokocli server paths left intact.)
2026-07-05 20:37:37 +00:00
jmiller 5fe246908c Merge pull request 'fix: move workflow-sync-trigger to custom/' (#15) from fix/move-workflow-sync-trigger into main
fix: move workflow-sync-trigger to custom/ [skip ci]
2026-06-30 18:06:50 +00:00
jmiller 1503cca367 chore: remove old workflow-sync-trigger from top-level [skip ci] 2026-06-30 18:03:50 +00:00
jmiller c5e5ca3261 chore: move workflow-sync-trigger to custom/ [skip ci] 2026-06-30 18:03:48 +00:00
jmiller f8a105ec7a Merge pull request 'chore(workflows): sync shared workflows from Template-Generic (main)' (#13) from fix/sync-from-generic into main 2026-06-27 19:28:50 +00:00
jmiller d70de91d3d chore(workflows): sync shared workflows from Template-Generic (main)
Authored-by: Moko Consulting
2026-06-27 14:27:39 -05:00
jmiller 6fa062a61a refactor: use ci-issue-reporter reusable workflow in repo-health [skip ci] 2026-06-25 17:27:16 +00:00
jmiller 36ce9234eb refactor: use ci-issue-reporter reusable workflow in pr-check [skip ci] 2026-06-25 17:26:47 +00:00
jmiller 444d9fc732 feat: add ci-issue-reporter reusable workflow [skip ci] 2026-06-25 17:26:02 +00:00
Moko Consulting [bot] d4e3aa57d0 fix: standardize token/URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:56:15 +00:00
Moko Consulting [bot] 026e7266b6 fix: standardize token/URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:56:09 +00:00
Moko Consulting [bot] eff49e0260 fix: standardize token/URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:55:37 +00:00
Moko Consulting [bot] a2ad009425 fix: standardize token/URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:55:31 +00:00
Moko Consulting [bot] ba05fec731 fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:27 +00:00
Moko Consulting [bot] bdd843c8d3 fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:24 +00:00
Moko Consulting [bot] 256e45f092 fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:21 +00:00
Moko Consulting [bot] 77ca6c37d4 fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:18 +00:00
Moko Consulting [bot] d5714805f8 fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:14 +00:00
Moko Consulting [bot] 780bb86b1f fix: standardize token and URL env vars to MOKOGITEA naming [skip ci] 2026-06-25 16:46:11 +00:00
jmiller f323e69fe0 chore: add version-set workflow [skip ci] 2026-06-23 22:00:28 +00:00
jmiller 43670c9e22 chore: remove security-audit.yml -- handled by MokoGitea 2026-06-23 18:05:54 +00:00
jmiller 0c60846ff6 chore: remove composer-publish.yml -- no longer needed 2026-06-23 18:00:40 +00:00
jmiller 0ce5dc1789 Merge pull request 'chore: remove automation directory' (#11) from fix/remove-automation into main 2026-06-21 23:10:31 +00:00
Jonathan Miller 698b8e9b18 chore: remove automation directory 2026-06-21 18:03:19 -05:00
jmiller 8af663df17 chore: sync auto-release.yml with semver tag support (#304) [skip ci] 2026-06-21 16:53:34 +00:00
jmiller 3e7f57c258 chore: sync auto-release.yml with semver tag support (#304) [skip ci] 2026-06-21 16:40:42 +00:00
jmiller e3e0a68a1c feat: add npm-publish workflow to MCP template 2026-06-21 05:49:31 +00:00
jmiller f216bd0f7c feat: add Composer publish workflow for Gitea registry + Packagist 2026-06-21 05:46:34 +00:00
jmiller 4c23fc5ae5 chore: delete manifest.xml (no longer used) 2026-06-21 00:19:40 +00:00
jmiller 6aee534334 refactor: merge PR workflows, reduce CI noise 2026-06-20 23:12:21 +00:00
jmiller 8ecee813dd refactor: merge PR workflows, reduce CI noise 2026-06-20 23:12:21 +00:00
jmiller d88e725cd3 refactor: merge PR workflows, reduce CI noise 2026-06-20 23:12:20 +00:00
jmiller af60e0af7e fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:17 +00:00
jmiller 1806f4f457 fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:16 +00:00
jmiller 06a23f53cc fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:16 +00:00
jmiller e8aea5bf6d fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:15 +00:00
jmiller ab5dca295e fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:14 +00:00
jmiller cf35adb1db fix: rename moko-platform to mokocli + changelog promotion in workflows 2026-06-20 17:16:13 +00:00
jmiller a5d777c62f fix(ci): restore full pre-release.yml content [skip ci] 2026-06-19 02:03:15 +00:00
jmiller 5154d97bff fix(ci): detect rebuild by branch name not version suffix [skip ci] 2026-06-19 02:01:49 +00:00
jmiller 591bfa76c3 ci: patch bump on same-branch rebuilds, minor only on elevation [skip ci] 2026-06-19 01:09:12 +00:00
jmiller dd13aff38c fix: update boilerplate references to correct repo name 2026-06-18 20:01:01 +00:00
jmiller 2aaa79c0d2 fix: update boilerplate references to correct repo name 2026-06-18 20:01:00 +00:00
jmiller 9b15d342b1 fix(ci): run repo-health on PR to main only, not on push 2026-06-18 16:39:43 +00:00
jmiller 521e4e4ba1 ci: add changelog extraction to promote-rc job [skip ci] 2026-06-18 16:37:30 +00:00
jmiller edc3316ac8 fix(ci): run CI on PR only, not on push 2026-06-18 16:13:52 +00:00
jmiller b9e4777d4a ci: deploy full pre-release workflow from mokoplatform [skip ci] 2026-06-18 13:47:53 +00:00
jmiller 1e301e7401 ci: disable auto-bump on push to dev [skip ci] 2026-06-16 20:46:33 +00:00
jmiller a9a01c322b fix(ci): rename secret refs to MOKOGITEA_TOKEN 2026-06-10 00:06:05 +00:00
jmiller 79b6aedf76 chore: sync security-audit.yml from Template-Generic [skip ci] 2026-06-07 17:51:19 +00:00
jmiller a91c05730e chore: sync pre-release.yml from Template-Generic [skip ci] 2026-06-07 17:51:19 +00:00
jmiller 1c1b23c640 chore: sync notify.yml from Template-Generic [skip ci] 2026-06-07 17:51:18 +00:00
jmiller 6f50658213 chore: sync ci-generic.yml from Template-Generic [skip ci] 2026-06-07 17:51:17 +00:00
jmiller 6a923039f8 chore: sync auto-release.yml from Template-Generic [skip ci] 2026-06-07 17:51:17 +00:00
Jonathan Miller ee15d17974 Merge remote-tracking branch 'origin/dev'
# Conflicts:
#	.mokogitea/workflows/pre-release.yml
2026-06-06 11:46:12 -05:00
jmiller e558156b11 Merge pull request 'chore: remove retired scripts directory' (#8) from dev into main
chore: remove retired scripts directory (#8)
2026-06-06 12:24:06 +00:00
jmiller 2a5aac40df chore: remove update-server workflow [skip ci] 2026-06-05 00:07:27 +00:00
jmiller a254b02b86 Merge pull request 'chore(ci): sync CI workflow updates from dev' (#7) from dev into main
chore(ci): sync CI workflow updates
2026-06-04 17:03:57 +00:00
gitea-actions[bot] 5e20194dd0 fix: ensure all pre-releases marked prerelease=true [skip ci] 2026-06-04 16:10:51 +00:00
jmiller 5fdce27fe2 chore: sync .mokogitea/workflows/pr-check.yml from moko-platform [skip ci] 2026-06-04 15:58:17 +00:00
jmiller 0de85a595f chore: sync .mokogitea/workflows/pr-check.yml from moko-platform [skip ci] 2026-06-04 15:40:43 +00:00
jmiller 89c21dee45 chore: sync .mokogitea/workflows/pr-check.yml from moko-platform [skip ci] 2026-06-04 15:32:06 +00:00
jmiller f2e3d2caa5 chore: sync .mokogitea/workflows/pr-check.yml from moko-platform [skip ci] 2026-06-04 15:18:55 +00:00
gitea-actions[bot] 419504ee4b chore: sync pre-release workflow — auto RC on PR to main [skip ci] 2026-06-04 14:45:47 +00:00
jmiller 436fa138e8 chore: sync .mokogitea/workflows/auto-release.yml from moko-platform [skip ci] 2026-06-04 14:23:20 +00:00
jmiller c606c3c453 chore: sync .mokogitea/workflows/repo-health.yml from moko-platform [skip ci] 2026-06-04 13:47:07 +00:00
jmiller aad56fc91a Merge pull request 'chore: gitignore config.json' (#5) from dev into main
fix(ci): add conflict-marker guard and remove RS_FTP_PATH_SUFFIX requirement
2026-06-03 03:50:56 +00:00
27 changed files with 160 additions and 297 deletions
+2 -2
View File
@@ -8,10 +8,10 @@ contact_links:
url: https://mokoconsulting.tech/ url: https://mokoconsulting.tech/
about: Get help or ask questions through our website about: Get help or ask questions through our website
- name: 📚 MokoStandards Documentation - name: 📚 MokoStandards Documentation
url: https://git.mokoconsulting.tech/MokoConsulting/moko-platform url: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
about: View our coding standards and best practices about: View our coding standards and best practices
- name: 🔒 Report a Security Vulnerability - name: 🔒 Report a Security Vulnerability
url: https://git.mokoconsulting.tech/mokoconsulting-tech/.github-private/security/advisories/new url: https://git.mokoconsulting.tech/MokoConsulting/.github-private/security/advisories/new
about: Report security vulnerabilities privately (for critical issues) about: Report security vulnerabilities privately (for critical issues)
- name: 💡 Community Discussions - name: 💡 Community Discussions
url: https://github.com/orgs/mokoconsulting-tech/discussions url: https://github.com/orgs/mokoconsulting-tech/discussions
+3 -3
View File
@@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: moko-platform.Automation # INGROUP: mokocli.Automation
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.gitea/workflows/branch-protection.yml # PATH: /.gitea/workflows/branch-protection.yml
# BRIEF: Apply standardised branch protection rules to all governed repositories # BRIEF: Apply standardised branch protection rules to all governed repositories
# #
@@ -62,7 +62,7 @@ jobs:
API="${GITEA_URL}/api/v1" API="${GITEA_URL}/api/v1"
# Platform/standards/infra repos to exclude # Platform/standards/infra repos to exclude
EXCLUDE="gitea-org-config org-profile gitea-private .mokogitea-private MokoStandards moko-platform MokoTesting" EXCLUDE="gitea-org-config org-profile gitea-private .mokogitea-private MokoStandards mokocli MokoTesting"
EXCLUDE="$EXCLUDE MokoStandards-Template-Client MokoStandards-Template-Dolibarr MokoStandards-Template-Generic MokoStandards-Template-Joomla MokoDoliProjTemplate" EXCLUDE="$EXCLUDE MokoStandards-Template-Client MokoStandards-Template-Dolibarr MokoStandards-Template-Generic MokoStandards-Template-Joomla MokoDoliProjTemplate"
if [ -n "${{ inputs.repos }}" ]; then if [ -n "${{ inputs.repos }}" ]; then
-24
View File
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
MokoStandards Repository Manifest
Template: MCP Server
See: https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home
-->
<moko-platform xmlns="https://standards.mokoconsulting.tech/moko-platform/1.0" schema-version="1.0">
<identity>
<name>Template-MCP</name>
<org>MokoConsulting</org>
<description>Template repository for Model Context Protocol (MCP) servers</description>
<license spdx="GPL-3.0-or-later">GNU General Public License v3</license>
</identity>
<governance>
<platform>mcp</platform>
<standards-version>05.00.00</standards-version>
<standards-source>https://git.mokoconsulting.tech/MokoConsulting/moko-platform</standards-source>
</governance>
<build>
<language>TypeScript</language>
<package-type>mcp-server</package-type>
<entry-point>src/</entry-point>
</build>
</moko-platform>
+2 -2
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Release # INGROUP: mokocli.Release
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.mokogitea/workflows/auto-bump.yml # PATH: /.mokogitea/workflows/auto-bump.yml
# VERSION: 09.02.00 # VERSION: 09.02.00
# BRIEF: Auto patch-bump version on every push to dev (skips merge commits) # BRIEF: Auto patch-bump version on every push to dev (skips merge commits)
@@ -52,7 +52,7 @@ jobs:
echo "MOKO_CLI=/opt/mokocli/cli" >> "$GITHUB_ENV" echo "MOKO_CLI=/opt/mokocli/cli" >> "$GITHUB_ENV"
else else
git clone --depth 1 --branch main --quiet \ git clone --depth 1 --branch main --quiet \
"https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/mokocli.git" \ "https://x-access-token:${{ secrets.MOKOGITEA_TOKEN }}@git.mokoconsulting.tech/MokoConsulting/MokoCLI.git" \
/tmp/mokocli /tmp/mokocli
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
echo "MOKO_CLI=/tmp/mokocli/cli" >> "$GITHUB_ENV" echo "MOKO_CLI=/tmp/mokocli/cli" >> "$GITHUB_ENV"
+3 -3
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Release # INGROUP: mokocli.Release
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /templates/workflows/universal/auto-release.yml.template # PATH: /templates/workflows/universal/auto-release.yml.template
# VERSION: 05.00.00 # VERSION: 05.00.00
# BRIEF: Universal build & release detects platform from manifest.xml # BRIEF: Universal build & release detects platform from manifest.xml
@@ -90,7 +90,7 @@ jobs:
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1 sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
fi fi
rm -rf /tmp/mokocli rm -rf /tmp/mokocli
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/mokocli.git CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
cd /tmp/mokocli cd /tmp/mokocli
composer install --no-dev --no-interaction --quiet composer install --no-dev --no-interaction --quiet
@@ -208,7 +208,7 @@ jobs:
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1 sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
fi fi
rm -rf /tmp/mokocli rm -rf /tmp/mokocli
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/mokocli.git CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
cd /tmp/mokocli cd /tmp/mokocli
composer install --no-dev --no-interaction --quiet composer install --no-dev --no-interaction --quiet
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: MokoStandards.Universal # INGROUP: MokoStandards.Universal
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.mokogitea/workflows/branch-cleanup.yml # PATH: /.mokogitea/workflows/branch-cleanup.yml
# VERSION: 01.00.00 # VERSION: 01.00.00
# BRIEF: Delete feature branches after PR merge # BRIEF: Delete feature branches after PR merge
@@ -34,6 +34,7 @@ jobs:
validate-changelog: validate-changelog:
name: Validate CHANGELOG.md name: Validate CHANGELOG.md
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
steps: steps:
- name: Checkout repository - name: Checkout repository
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Universal # INGROUP: mokocli.Universal
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.mokogitea/workflows/ci-issue-reporter.yml # PATH: /.mokogitea/workflows/ci-issue-reporter.yml
# VERSION: 01.00.00 # VERSION: 01.00.00
# BRIEF: Reusable workflow — creates/updates a Gitea issue when a CI gate fails. # BRIEF: Reusable workflow — creates/updates a Gitea issue when a CI gate fails.
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Universal # INGROUP: mokocli.Universal
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.mokogitea/workflows/workflow-sync-trigger.yml # PATH: /.mokogitea/workflows/workflow-sync-trigger.yml
# VERSION: 01.01.00 # VERSION: 01.01.00
# BRIEF: Trigger workflow sync to live repos when a PR is merged to main # BRIEF: Trigger workflow sync to live repos when a PR is merged to main
@@ -52,7 +52,7 @@ jobs:
MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }} MOKOGITEA_TOKEN: ${{ secrets.MOKOGITEA_TOKEN }}
run: | run: |
MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}" MOKOGITEA_URL="${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}"
git clone --depth 1 "${MOKOGITEA_URL}/MokoConsulting/mokocli.git" /tmp/mokocli git clone --depth 1 "${MOKOGITEA_URL}/MokoConsulting/MokoCLI.git" /tmp/mokocli
- name: Install PHP - name: Install PHP
run: | run: |
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: MokoStandards.Security # INGROUP: MokoStandards.Security
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/MokoStandards-API # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
# PATH: /templates/workflows/gitleaks.yml.template # PATH: /templates/workflows/gitleaks.yml.template
# VERSION: 01.00.00 # VERSION: 01.00.00
# BRIEF: Secret scanning — detect leaked credentials, API keys, and tokens # BRIEF: Secret scanning — detect leaked credentials, API keys, and tokens
+4 -3
View File
@@ -32,7 +32,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: >- if: >-
!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip ci]') &&
github.actor != 'github-actions[bot]' github.actor != 'github-actions[bot]' &&
!startsWith(github.event.repository.name, 'Template-')
steps: steps:
- name: Checkout repository - name: Checkout repository
@@ -87,13 +88,13 @@ jobs:
done done
# ── Version ────────────────────────────────────────────────────── # ── Version ──────────────────────────────────────────────────────
- name: Setup moko-platform tools - name: Setup mokocli tools
env: env:
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }} GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}' COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}'
run: | run: |
git clone --depth 1 --branch version/04 --quiet \ git clone --depth 1 --branch version/04 --quiet \
"https://x-access-token:${GH_TOKEN}@github.com/MokoConsulting/moko-platform.git" \ "https://x-access-token:${GH_TOKEN}@github.com/MokoConsulting/MokoCLI.git" \
/tmp/mokostandards /tmp/mokostandards
cd /tmp/mokostandards cd /tmp/mokostandards
composer install --no-dev --no-interaction --quiet composer install --no-dev --no-interaction --quiet
+1
View File
@@ -22,6 +22,7 @@ permissions:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
strategy: strategy:
matrix: matrix:
node-version: [20, 22] node-version: [20, 22]
+1
View File
@@ -19,6 +19,7 @@ permissions:
jobs: jobs:
check-sdk: check-sdk:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+114
View File
@@ -0,0 +1,114 @@
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
# SPDX-License-Identifier: GPL-3.0-or-later
name: "Publish to npm"
on:
push:
branches:
- main
workflow_dispatch:
env:
MOKOGITEA_URL: ${{ vars.GITEA_URL || 'https://git.mokoconsulting.tech' }}
GITEA_ORG: ${{ vars.GITEA_ORG || github.repository_owner }}
GITEA_REPO: ${{ vars.GITEA_REPO || github.event.repository.name }}
jobs:
publish:
runs-on: ubuntu-latest
if: >-
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip publish]') &&
!startsWith(github.event.repository.name, 'Template-')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Auto-bump patch version
run: |
API_BASE="${MOKOGITEA_URL}/api/v1/repos/${GITEA_ORG}/${GITEA_REPO}"
TOKEN="${{ secrets.MOKOGITEA_TOKEN }}"
PKG_NAME=$(node -p "require('./package.json').name")
CURRENT=$(node -p "require('./package.json').version")
PUBLISHED=$(npm view "${PKG_NAME}@latest" version 2>/dev/null || echo "0.0.0")
if [ "$CURRENT" != "$PUBLISHED" ]; then
echo "Version ${CURRENT} not yet published, using as-is."
exit 0
fi
# Bump locally to get the new version
npm version patch --no-git-tag-version
NEW_VER=$(node -p "require('./package.json').version")
echo "Bumping ${CURRENT} -> ${NEW_VER}"
# Push via Gitea API: branch + PR + merge
BRANCH="chore/npm-version-bump"
FILEPATH="package.json"
CONTENT=$(base64 -w 0 < package.json)
COMMIT_MSG="chore: bump to ${NEW_VER} [skip ci]"
# Get current file SHA on main
FILE_SHA=$(curl -sf -H "Authorization: token ${TOKEN}" \
"${API_BASE}/contents/${FILEPATH}?ref=main" \
| python3 -c "import json,sys; print(json.load(sys.stdin).get('sha',''))" 2>/dev/null || true)
# Create chore branch from main
curl -sf -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"${API_BASE}/branches" \
-d "{\"new_branch_name\":\"${BRANCH}\",\"old_branch_name\":\"main\"}" 2>/dev/null || true
# Get file SHA on chore branch (may differ if branch already existed)
BRANCH_SHA=$(curl -sf -H "Authorization: token ${TOKEN}" \
"${API_BASE}/contents/${FILEPATH}?ref=${BRANCH}" \
| python3 -c "import json,sys; print(json.load(sys.stdin).get('sha',''))" 2>/dev/null || true)
[ -n "$BRANCH_SHA" ] && FILE_SHA="$BRANCH_SHA"
# Push package.json to chore branch
PAYLOAD="{\"content\":\"${CONTENT}\",\"message\":\"${COMMIT_MSG}\",\"branch\":\"${BRANCH}\",\"sha\":\"${FILE_SHA}\"}"
HTTP=$(curl -sf -o /dev/null -w "%{http_code}" -X PUT \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "$PAYLOAD" \
"${API_BASE}/contents/${FILEPATH}" 2>/dev/null || echo "ERR")
echo "File push: HTTP ${HTTP}"
# Create PR
PR_NUM=$(curl -sf -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"${API_BASE}/pulls" \
-d "{\"title\":\"${COMMIT_MSG}\",\"head\":\"${BRANCH}\",\"base\":\"main\"}" \
| python3 -c "import json,sys; print(json.load(sys.stdin).get('number',''))" 2>/dev/null || true)
if [ -n "$PR_NUM" ]; then
# Merge PR
curl -sf -X POST -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"${API_BASE}/pulls/${PR_NUM}/merge" \
-d "{\"Do\":\"merge\",\"merge_message_field\":\"${COMMIT_MSG}\"}" 2>/dev/null
echo "Version bumped via PR #${PR_NUM} (merged)"
else
echo "::warning::Could not create PR for version bump — publishing with current version"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+2 -2
View File
@@ -4,8 +4,8 @@
# #
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: moko-platform.CI # INGROUP: mokocli.CI
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/moko-platform # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /templates/workflows/universal/pr-check.yml.template # PATH: /templates/workflows/universal/pr-check.yml.template
# VERSION: 09.23.00 # VERSION: 09.23.00
# BRIEF: PR gate — branch policy + code validation before merge # BRIEF: PR gate — branch policy + code validation before merge
+2 -2
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Release # INGROUP: mokocli.Release
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /templates/workflows/universal/pre-release.yml.template # PATH: /templates/workflows/universal/pre-release.yml.template
# VERSION: 05.02.00 # VERSION: 05.02.00
# BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches # BRIEF: Auto pre-release on push to dev/alpha/beta/rc branches
@@ -80,7 +80,7 @@ jobs:
sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1 sudo apt-get update -qq && sudo apt-get install -y -qq php-cli php-mbstring php-xml php-zip php-curl composer > /dev/null 2>&1
fi fi
rm -rf /tmp/mokocli rm -rf /tmp/mokocli
CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/mokocli.git CLONE_URL=https://x-access-token:${MOKO_CLONE_TOKEN}@${MOKO_CLONE_HOST}/MokoCLI.git
git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli git clone --depth 1 --branch main --quiet $CLONE_URL /tmp/mokocli
cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet cd /tmp/mokocli && composer install --no-dev --no-interaction --quiet
echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV echo MOKO_CLI=/tmp/mokocli/cli >> $GITHUB_ENV
+1 -1
View File
@@ -5,7 +5,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Universal # INGROUP: mokocli.Universal
# REPO: https://git.mokoconsulting.tech/MokoConsulting/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /.mokogitea/workflows/rc-revert.yml # PATH: /.mokogitea/workflows/rc-revert.yml
# VERSION: 09.23.00 # VERSION: 09.23.00
# BRIEF: Rename rc/ branch back to dev/ when PR is closed without merge # BRIEF: Rename rc/ branch back to dev/ when PR is closed without merge
+1 -1
View File
@@ -8,7 +8,7 @@
# FILE INFORMATION # FILE INFORMATION
# DEFGROUP: Gitea.Workflow # DEFGROUP: Gitea.Workflow
# INGROUP: mokocli.Validation # INGROUP: mokocli.Validation
# REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/mokocli # REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoCLI
# PATH: /templates/workflows/joomla/repo_health.yml.template # PATH: /templates/workflows/joomla/repo_health.yml.template
# VERSION: 09.23.00 # VERSION: 09.23.00
# BRIEF: Enforces repository guardrails by validating scripts governance, tooling availability, and core repository health artifacts. # BRIEF: Enforces repository guardrails by validating scripts governance, tooling availability, and core repository health artifacts.
@@ -39,12 +39,13 @@ jobs:
sync-version: sync-version:
name: Propagate README version name: Propagate README version
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.repository.name, 'Template-') }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with: with:
token: ${{ secrets.GH_TOKEN || github.token }} token: ${{ secrets.GH_MIRROR_TOKEN || github.token }}
fetch-depth: 0 fetch-depth: 0
- name: Set up PHP - name: Set up PHP
@@ -55,8 +56,8 @@ jobs:
- name: Setup MokoStandards tools - name: Setup MokoStandards tools
env: env:
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }} GH_TOKEN: ${{ secrets.GH_MIRROR_TOKEN || github.token }}
COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_TOKEN || github.token }}"}}' COMPOSER_AUTH: '{"github-oauth":{"github.com":"${{ secrets.GH_MIRROR_TOKEN || github.token }}"}}'
run: | run: |
git clone --depth 1 --branch version/04 --quiet \ git clone --depth 1 --branch version/04 --quiet \
"https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \ "https://x-access-token:${GH_TOKEN}@github.com/mokoconsulting-tech/MokoStandards.git" \
@@ -106,7 +107,7 @@ jobs:
--create-issue \ --create-issue \
--repo "${{ github.repository }}" --repo "${{ github.repository }}"
env: env:
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }} GH_TOKEN: ${{ secrets.GH_MIRROR_TOKEN || github.token }}
- name: Commit updated files - name: Commit updated files
if: ${{ steps.readme_version.outputs.skip != 'true' && inputs.dry_run != true }} if: ${{ steps.readme_version.outputs.skip != 'true' && inputs.dry_run != true }}
+1
View File
@@ -8,4 +8,5 @@
- HCL definition files removed -- Template repos are now the canonical source - HCL definition files removed -- Template repos are now the canonical source
### Added ### Added
- CI: gate build/CI/release/version workflows so they skip template repos; smart-gate the sync workflows to run only on Template-* repos; normalize mokocli/MokoCLI refs and drop the stale mokoconsulting-tech org slug.
- `branch-cleanup.yml`: auto-delete merged feature branches after PR merge - `branch-cleanup.yml`: auto-delete merged feature branches after PR merge
+2 -2
View File
@@ -13,7 +13,7 @@ This file provides guidance to Claude Code when working with this repository.
| **Default branch** | main | | **Default branch** | main |
| **License** | GPL-3.0-or-later | | **License** | GPL-3.0-or-later |
| **Wiki** | [Template-MCP Wiki](https://git.mokoconsulting.tech/MokoConsulting/Template-MCP/wiki) | | **Wiki** | [Template-MCP Wiki](https://git.mokoconsulting.tech/MokoConsulting/Template-MCP/wiki) |
| **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) | | **Standards** | [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home) |
## Common Commands ## Common Commands
@@ -49,4 +49,4 @@ This is an MCP (Model Context Protocol) server. Key files:
- **Branch strategy**: develop on `dev`, merge to `main` for release - **Branch strategy**: develop on `dev`, merge to `main` for release
- **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates) - **Minification**: handled at build time (CI) and runtime (MokoMinifyHelper for Joomla templates)
- **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files - **Wiki**: documentation lives in the Gitea wiki, not in `docs/` files
- **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home) - **Standards**: this repo follows [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home)
+1 -1
View File
@@ -13,7 +13,7 @@
# FILE INFORMATION # FILE INFORMATION
DEFGROUP: DEFGROUP:
INGROUP: Project.Documentation INGROUP: Project.Documentation
REPO: mokoconsulting-tech/MokoStandards-Template-Generic REPO: MokoConsulting/Template-MCP
VERSION: 00.00.01 VERSION: 00.00.01
PATH: ./CODE_OF_CONDUCT.md PATH: ./CODE_OF_CONDUCT.md
BRIEF: Contributor Covenant Code of Conduct version 1.3.0 BRIEF: Contributor Covenant Code of Conduct version 1.3.0
+2 -2
View File
@@ -13,13 +13,13 @@
# FILE INFORMATION # FILE INFORMATION
DEFGROUP: DEFGROUP:
INGROUP: Project.Documentation INGROUP: Project.Documentation
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-Template-Generic REPO: https://git.mokoconsulting.tech/MokoConsulting/Template-MCP
VERSION: 00.00.01 VERSION: 00.00.01
PATH: ./CONTRIBUTING.md PATH: ./CONTRIBUTING.md
BRIEF: Contribution guidelines for the project BRIEF: Contribution guidelines for the project
--> -->
# Contributing to MokoStandards-Template-Generic # Contributing to Template-MCP
We appreciate your interest in contributing to this project! This document provides guidelines for contributing. We appreciate your interest in contributing to this project! This document provides guidelines for contributing.
+1 -1
View File
@@ -13,7 +13,7 @@
# FILE INFORMATION # FILE INFORMATION
DEFGROUP: MokoStandards DEFGROUP: MokoStandards
INGROUP: MokoStandards.Documentation INGROUP: MokoStandards.Documentation
REPO: https://git.mokoconsulting.tech/mokoconsulting-tech/MokoStandards/ REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards/
VERSION: 05.00.00 VERSION: 05.00.00
PATH: ./LICENSE PATH: ./LICENSE
BRIEF: Project license (GPL-3.0-or-later) BRIEF: Project license (GPL-3.0-or-later)
+1 -1
View File
@@ -23,7 +23,7 @@ install-deps: ## Install dependencies
@$(NPM) install @$(NPM) install
@echo "$(COLOR_GREEN)✓ Dependencies installed$(COLOR_RESET)" @echo "$(COLOR_GREEN)✓ Dependencies installed$(COLOR_RESET)"
MOKO_PLATFORM ?= $(or $(wildcard ../moko-platform),$(wildcard $(HOME)/moko-platform),$(wildcard /opt/moko-platform)) MOKO_PLATFORM ?= $(or $(wildcard ../mokocli),$(wildcard $(HOME)/mokocli),$(wildcard /opt/mokocli))
MINIFY_SCRIPT := $(MOKO_PLATFORM)/build/minify.js MINIFY_SCRIPT := $(MOKO_PLATFORM)/build/minify.js
.PHONY: minify .PHONY: minify
+5 -1
View File
@@ -77,4 +77,8 @@ This project is licensed under the GNU General Public License v3.0 or later -- s
--- ---
*[Moko Consulting](https://mokoconsulting.tech) -- [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/moko-platform/wiki/Home)* *[Moko Consulting](https://mokoconsulting.tech) -- [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/MokoCLI/wiki/Home)*
## Template CI Notes
Build/CI/release/version workflows are guarded to skip template repos (Template-*) and only run in repos created from them.
-237
View File
@@ -1,237 +0,0 @@
#!/usr/bin/env bash
# ============================================================================
# Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# FILE INFORMATION
# DEFGROUP: Automation.CI
# INGROUP: moko-platform.Automation
# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform
# PATH: /automation/ci-issue-reporter.sh
# VERSION: 09.23.00
# BRIEF: Creates or updates a Gitea issue when a CI gate fails.
# Deduplicates by searching open issues with the "ci-auto" label
# whose title matches the gate. If a matching issue exists, a comment
# is appended instead of opening a duplicate.
# ============================================================================
set -euo pipefail
# ── Defaults ────────────────────────────────────────────────────────────────
GITEA_URL="${GITEA_URL:-https://git.mokoconsulting.tech}"
GITEA_TOKEN="${GITEA_TOKEN:-}"
REPO="${GITHUB_REPOSITORY:-}"
RUN_URL="${GITHUB_SERVER_URL:-${GITEA_URL}}/${REPO}/actions/runs/${GITHUB_RUN_ID:-0}"
LABEL_NAME="ci-auto"
LABEL_COLOR="#e11d48"
GATE=""
DETAILS=""
SEVERITY="error"
WORKFLOW=""
# ── Parse arguments ─────────────────────────────────────────────────────────
usage() {
cat <<EOF
Usage: ci-issue-reporter.sh --gate NAME --details TEXT [OPTIONS]
Required:
--gate CI gate name (e.g. "Code Quality", "Self-Health")
--details Human-readable failure description
Optional:
--severity "error" (default) or "warning"
--workflow Workflow name for the issue title
--repo owner/repo (default: \$GITHUB_REPOSITORY)
--run-url URL to the CI run (auto-detected from env)
--token Gitea API token (default: \$GITEA_TOKEN)
--url Gitea base URL (default: \$GITEA_URL)
EOF
exit 1
}
while [[ $# -gt 0 ]]; do
case "$1" in
--gate) GATE="$2"; shift 2 ;;
--details) DETAILS="$2"; shift 2 ;;
--severity) SEVERITY="$2"; shift 2 ;;
--workflow) WORKFLOW="$2"; shift 2 ;;
--repo) REPO="$2"; shift 2 ;;
--run-url) RUN_URL="$2"; shift 2 ;;
--token) GITEA_TOKEN="$2"; shift 2 ;;
--url) GITEA_URL="$2"; shift 2 ;;
-h|--help) usage ;;
*) echo "Unknown option: $1"; usage ;;
esac
done
[[ -z "$GATE" ]] && { echo "ERROR: --gate is required"; usage; }
[[ -z "$DETAILS" ]] && { echo "ERROR: --details is required"; usage; }
[[ -z "$GITEA_TOKEN" ]] && { echo "ERROR: GITEA_TOKEN not set"; exit 1; }
[[ -z "$REPO" ]] && { echo "ERROR: GITHUB_REPOSITORY not set"; exit 1; }
API="${GITEA_URL}/api/v1/repos/${REPO}"
# ── Build title ─────────────────────────────────────────────────────────────
if [[ -n "$WORKFLOW" ]]; then
TITLE="[CI] ${WORKFLOW}: ${GATE} failed"
else
TITLE="[CI] ${GATE} failed"
fi
# ── Ensure label exists ─────────────────────────────────────────────────────
ensure_label() {
local exists
exists=$(curl -sf -o /dev/null -w '%{http_code}' \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/labels" 2>/dev/null || echo "000")
if [[ "$exists" == "200" ]]; then
# Check if label already exists
local found
found=$(curl -sf \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/labels" 2>/dev/null \
| grep -o "\"name\":\"${LABEL_NAME}\"" || true)
if [[ -z "$found" ]]; then
curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${API}/labels" \
-d "{\"name\":\"${LABEL_NAME}\",\"color\":\"${LABEL_COLOR}\",\"description\":\"Auto-created by CI issue reporter\"}" \
> /dev/null 2>&1 || true
fi
fi
}
# ── Search for existing open issue ──────────────────────────────────────────
find_existing_issue() {
# URL-encode the gate name for the query
local query
query=$(printf '%s' "[CI] ${GATE}" | sed 's/ /%20/g; s/\[/%5B/g; s/\]/%5D/g')
local response
response=$(curl -sf \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/issues?type=issues&state=open&labels=${LABEL_NAME}&q=${query}&limit=5" \
2>/dev/null || echo "[]")
# Extract the first matching issue number
echo "$response" \
| grep -oP '"number":\s*\K[0-9]+' \
| head -1
}
# ── Build issue body ────────────────────────────────────────────────────────
build_body() {
local severity_badge
if [[ "$SEVERITY" == "error" ]]; then
severity_badge="**Severity:** Error"
else
severity_badge="**Severity:** Warning"
fi
cat <<BODY
## CI Gate Failure: ${GATE}
${severity_badge}
**Workflow:** ${WORKFLOW:-unknown}
**Branch:** ${GITHUB_REF_NAME:-unknown}
**Commit:** \`${GITHUB_SHA:0:8}\`
**Run:** [View CI run](${RUN_URL})
### Details
${DETAILS}
### Resolution
Fix the issue described above and push a new commit. This issue will be closed automatically when the gate passes, or can be closed manually.
---
*Auto-created by [ci-issue-reporter](${GITEA_URL}/${REPO}/src/branch/main/automation/ci-issue-reporter.sh)*
BODY
}
# ── Build comment body (for existing issues) ────────────────────────────────
build_comment() {
cat <<COMMENT
### CI failure recurrence
**Branch:** ${GITHUB_REF_NAME:-unknown}
**Commit:** \`${GITHUB_SHA:0:8}\`
**Run:** [View CI run](${RUN_URL})
${DETAILS}
COMMENT
}
# ── Main ────────────────────────────────────────────────────────────────────
ensure_label
EXISTING=$(find_existing_issue)
if [[ -n "$EXISTING" ]]; then
# Append comment to existing issue
COMMENT_BODY=$(build_comment)
COMMENT_JSON=$(printf '%s' "$COMMENT_BODY" | python3 -c "
import sys, json
print(json.dumps({'body': sys.stdin.read()}))" 2>/dev/null)
HTTP=$(curl -sf -o /dev/null -w '%{http_code}' -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${API}/issues/${EXISTING}/comments" \
-d "${COMMENT_JSON}" 2>/dev/null || echo "000")
if [[ "$HTTP" == "201" ]]; then
echo "Commented on existing issue #${EXISTING}"
else
echo "WARNING: Failed to comment on issue #${EXISTING} (HTTP ${HTTP})"
fi
else
# Create new issue
ISSUE_BODY=$(build_body)
ISSUE_JSON=$(python3 -c "
import sys, json
body = sys.stdin.read()
print(json.dumps({
'title': sys.argv[1],
'body': body,
'labels': []
}))" "$TITLE" <<< "$ISSUE_BODY" 2>/dev/null)
# Create the issue
RESPONSE=$(curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${API}/issues" \
-d "${ISSUE_JSON}" 2>/dev/null || echo "{}")
ISSUE_NUM=$(echo "$RESPONSE" | grep -oP '"number":\s*\K[0-9]+' | head -1)
if [[ -n "$ISSUE_NUM" ]]; then
# Apply label (separate call — more reliable across Gitea versions)
LABEL_ID=$(curl -sf \
-H "Authorization: token ${GITEA_TOKEN}" \
"${API}/labels" 2>/dev/null \
| grep -oP "\"id\":\s*\K[0-9]+(?=[^}]*\"name\":\s*\"${LABEL_NAME}\")" \
| head -1 || true)
if [[ -n "$LABEL_ID" ]]; then
curl -sf -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${API}/issues/${ISSUE_NUM}/labels" \
-d "{\"labels\":[${LABEL_ID}]}" \
> /dev/null 2>&1 || true
fi
echo "Created issue #${ISSUE_NUM}: ${TITLE}"
else
echo "WARNING: Failed to create issue"
echo "Response: ${RESPONSE}"
fi
fi