File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Notify Private Repo of Update
2+
3+ env :
4+ SDK_NAME : sinch-sdk-java
5+
6+ on :
7+ push :
8+
9+ jobs :
10+ ping-private :
11+ if : |
12+ github.actor != 'sinch-internal-repo-sync-app[bot]' && !endsWith(github.event.repository.name, 'internal')
13+
14+ runs-on : ubuntu-latest
15+ steps :
16+ # 1. Generate a temporary token from the GitHub App
17+ - name : Generate GitHub App Token
18+ uses : actions/create-github-app-token@v3
19+ id : app-token
20+ with :
21+ client-id : ${{ vars.SINCH_INTERNAL_REPO_SYNC_APP_CLIENT_ID }}
22+ private-key : ${{ secrets.SINCH_INTERNAL_REPO_SYNC_APP_PRIVATE_KEY }}
23+ # Explicitly request access to the internal repository:
24+ owner : ${{ github.repository_owner }}
25+ repositories : ${{ env.SDK_NAME }}-internal
26+
27+ # 2. Use that token to send the "ping" to the private repo
28+ - name : Send Repository Dispatch to Private Repo
29+ env :
30+ SYNC_TOKEN : ${{ steps.app-token.outputs.token }}
31+ run : |
32+ curl -X POST --fail-with-body \
33+ -H "Content-Type: application/json" \
34+ -H "Authorization: Bearer ${SYNC_TOKEN}" \
35+ -H "Accept: application/vnd.github.v3+json" \
36+ -H "X-GitHub-Api-Version: 2026-03-10" \
37+ https://api.github.com/repos/sinch/${SDK_NAME}-internal/dispatches \
38+ -d '{"event_type": "public_push_event"}'
Original file line number Diff line number Diff line change 1+ name : Sync From Public
2+
3+ env :
4+ SDK_NAME : sinch-sdk-java
5+
6+ # Ensures only one sync runs at a time. Cancels any running sync when a new trigger arrives.
7+ concurrency :
8+ group : sync-repo-${{ github.repository }}
9+ cancel-in-progress : true
10+
11+ on :
12+ schedule :
13+ # Runs only once a day at midnight to catch any missed updates
14+ - cron : ' 0 0 * * *'
15+ repository_dispatch :
16+ types : [public_push_event] # Keeps your instant trigger active
17+ workflow_dispatch : # Allows manual run
18+
19+ jobs :
20+ sync-repo :
21+ if : endsWith(github.event.repository.name, 'internal')
22+ runs-on : ubuntu-latest
23+ steps :
24+ # 1. Generate a temporary installation token using the GitHub App
25+ - name : Generate GitHub App Token
26+ uses : actions/create-github-app-token@v3
27+ id : app-token
28+ with :
29+ client-id : ${{ vars.SINCH_INTERNAL_REPO_SYNC_APP_CLIENT_ID }}
30+ private-key : ${{ secrets.SINCH_INTERNAL_REPO_SYNC_APP_PRIVATE_KEY }}
31+
32+ # 2. Execute the sync using the short-lived token
33+ - name : Sync Public to Private
34+ env :
35+ SYNC_TOKEN : ${{ steps.app-token.outputs.token }}
36+ run : |
37+ # Clone the public repository as a bare repo (read-only, public)
38+ git clone --bare https://github.com/sinch/$SDK_NAME.git public_repo
39+ cd public_repo
40+
41+ # Push all branches and tags to the private repo using the App Token
42+ git push --all https://x-access-token:${SYNC_TOKEN}@github.com/sinch/${SDK_NAME}-internal.git
43+ git push --tags https://x-access-token:${SYNC_TOKEN}@github.com/sinch/${SDK_NAME}-internal.git
You can’t perform that action at this time.
0 commit comments