-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (80 loc) · 3.27 KB
/
Copy pathreconcile-org-refs.yml
File metadata and controls
88 lines (80 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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:
# Hourly at :50 — after mirror-to-osp (:00) detects new repos, patches
# land in Interested-Deving-1896, then mirror-to-osp picks them up next hour.
- cron: "50 * * * *"
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
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
REPO_FILTER: ${{ inputs.repo_filter || '' }}
DRY_RUN: ${{ inputs.dry_run || 'false' }}
ORGS_FILTER: ${{ inputs.orgs || 'all' }}
run: bash scripts/reconcile-org-refs.sh
- name: Write summary
if: always()
env:
JOB_STATUS: ${{ job.status }}
INPUTS_JSON: ${{ toJSON(inputs) }}
run: bash scripts/write-summary.sh