From c6db1aa5fcc5959128eeb31fddf03c1efa91b249 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Sat, 16 May 2026 18:56:40 +0000 Subject: [PATCH] chore: move .mokogitea/bulk-repo-sync.yml to .gitea/bulk-repo-sync.yml [skip ci] --- .gitea/bulk-repo-sync.yml | 135 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 .gitea/bulk-repo-sync.yml diff --git a/.gitea/bulk-repo-sync.yml b/.gitea/bulk-repo-sync.yml new file mode 100644 index 0000000..c81f0ad --- /dev/null +++ b/.gitea/bulk-repo-sync.yml @@ -0,0 +1,135 @@ +# Copyright (C) 2026 Moko Consulting +# SPDX-License-Identifier: GPL-3.0-or-later +# FILE INFORMATION +# DEFGROUP: Gitea.Workflow +# INGROUP: MokoStandards-API.Automation +# REPO: https://git.mokoconsulting.tech/MokoConsulting/moko-platform +# PATH: /.gitea/workflows/bulk-repo-sync.yml +# BRIEF: Bulk repo sync — runs from API repo, syncs standards to all governed repos + +name: Bulk Repository Sync + +on: + schedule: + - cron: '0 0 1 * *' + workflow_dispatch: + inputs: + dry_run: + description: 'Preview mode (no changes)' + required: false + type: boolean + default: true + repos: + description: 'Comma-separated repo names (empty = all)' + required: false + type: string + default: '' + exclude: + description: 'Comma-separated repos to skip' + required: false + type: string + default: '' + force: + description: 'Force overwrite protected files' + required: false + type: boolean + default: false + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + bulk-sync: + name: Sync Standards to Repositories + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: json, mbstring, curl + tools: composer + coverage: none + + - name: Install Dependencies + run: composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader + + - name: Build CLI Arguments + id: args + run: | + ARGS="--org MokoConsulting" + if [ "${{ inputs.dry_run }}" = "true" ] || [ "${{ gitea.event_name }}" = "schedule" ]; then + ARGS="$ARGS --dry-run" + fi + if [ -n "${{ inputs.repos }}" ]; then + ARGS="$ARGS --repos ${{ inputs.repos }}" + fi + if [ -n "${{ inputs.exclude }}" ]; then + ARGS="$ARGS --exclude ${{ inputs.exclude }}" + fi + if [ "${{ inputs.force }}" = "true" ]; then + ARGS="$ARGS --force" + fi + ARGS="$ARGS --yes" + echo "args=$ARGS" >> $GITHUB_OUTPUT + + - name: Run Bulk Sync + run: | + echo "Running: php automation/bulk_sync.php ${{ steps.args.outputs.args }}" + php automation/bulk_sync.php ${{ steps.args.outputs.args }} 2>&1 | tee /tmp/bulk_sync.log + env: + GA_TOKEN: ${{ secrets.GA_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN }} + GIT_PLATFORM: gitea + GITEA_URL: https://git.mokoconsulting.tech + GITEA_ORG: MokoConsulting + + - name: Commit Updated Definitions + if: success() && inputs.dry_run != 'true' + run: | + if [ -n "$(git status --porcelain definitions/sync/)" ]; then + git config user.name "gitea-actions[bot]" + git config user.email "gitea-actions[bot]@git.mokoconsulting.tech" + git add definitions/sync/*.def.tf + git commit -m "chore: update synced repository definitions" || true + git push || true + fi + + - name: Enforce Release Channel Tags + if: success() + continue-on-error: true + run: | + echo "Enforcing standard tags on all repos..." + if [ "${{ inputs.dry_run }}" = "true" ]; then + bash automation/enforce_tags.sh --dry-run || echo "Tag enforcement skipped (non-fatal)" + else + bash automation/enforce_tags.sh || echo "Tag enforcement had errors (non-fatal)" + fi + env: + GA_TOKEN: ${{ secrets.GA_TOKEN }} + GITEA_URL: https://git.mokoconsulting.tech + GITEA_ORG: MokoConsulting + + - name: Upload Sync Log + if: always() && github.server_url == 'https://github.com' + uses: actions/upload-artifact@v4 + with: + name: bulk-sync-log-${{ github.run_number }} + path: /tmp/bulk_sync.log + retention-days: 30 + + - name: Log Summary (Gitea) + if: always() && github.server_url != 'https://github.com' + run: | + if [ -f /tmp/bulk_sync.log ]; then + echo "## Sync Log (last 20 lines)" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + tail -20 /tmp/bulk_sync.log >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + fi