Reconcile Org References #56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Reconcile Org References | |
| # Rewrites Interested-Deving-1896 references in OSP and OOC mirror repos | |
| # so URLs, comments, and non-guard lines point to the correct org. | |
| # Job guards (`if: github.repository ==`) are never touched — mirrors stay passive. | |
| # | |
| # Third pass: rewrites self-referential GitHub URLs in GitLab mirrors to their | |
| # gitlab.com/openos-project/{subgroup}/{repo} equivalents. Requires GITLAB_TOKEN. | |
| # Skipped non-fatally if GITLAB_TOKEN is absent. | |
| on: | |
| schedule: | |
| # Daily at 05:50 UTC — org reference rewrites are not time-critical and | |
| # the hourly cadence was consuming 1000-3000 API calls/hr, exhausting the | |
| # 5000/hr budget. Off-peak time avoids overlap with the 02:00-03:xx mirror | |
| # and README sweeps. | |
| - cron: "50 5 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| repo_filter: | |
| description: "Repo name substring filter (blank = all)" | |
| required: false | |
| default: "" | |
| dry_run: | |
| description: "Dry run — print rewrites without applying them" | |
| type: boolean | |
| required: false | |
| default: false | |
| orgs: | |
| description: "Which orgs to reconcile" | |
| type: choice | |
| required: false | |
| default: "all" | |
| options: | |
| - all | |
| - osp-only | |
| - ooc-only | |
| - gitlab-only | |
| force_reconcile: | |
| description: "Bypass the pushed_at gate and scan all repos regardless of last push time" | |
| type: boolean | |
| required: false | |
| default: false | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| # ── Rate limits ────────────────────────────────────────────────────────────── | |
| # Highest GitHub API usage of any workflow here: reads file trees and file | |
| # contents across all repos in OSP and OOC. | |
| # GitHub REST API (SYNC_TOKEN): 5 000 req/hr primary limit. | |
| # reconcile-org-refs.sh retries HTTP 403/429 up to 3 times, sleeping until | |
| # X-RateLimit-Reset. A single run may consume 1 000–3 000 requests on large | |
| # orgs. Schedule (:50) is offset from mirror-to-osp (:00) to avoid | |
| # compounding usage within the same reset window. | |
| # timeout-minutes: 60 — if the primary limit is hit and reset is >60 min away | |
| # the job times out; the next scheduled run will complete normally. | |
| # GitLab REST API (GITLAB_TOKEN): 2 000 req/min — well within budget for the | |
| # GitLab pass which sleeps 1s between file operations. | |
| jobs: | |
| reconcile: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Check if SYNC_TOKEN is set | |
| run: | | |
| if [ -z "${{ secrets.SYNC_TOKEN }}" ]; then | |
| echo "Error: SYNC_TOKEN secret is not set. Please configure it in the repository secrets." | |
| exit 1 | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Rewrite org references in OSP + OOC mirrors + GitLab | |
| env: | |
| GH_TOKEN: ${{ secrets.SYNC_TOKEN }} | |
| GITLAB_TOKEN: ${{ secrets.GITLAB_SYNC_TOKEN }} | |
| UPSTREAM_OWNER: Interested-Deving-1896 | |
| OSP_ORG: OpenOS-Project-OSP | |
| OOC_ORG: OpenOS-Project-Ecosystem-OOC | |
| run: bash scripts/reconcile-org-refs.sh |