-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (34 loc) · 1.34 KB
/
sync-fork.yml
File metadata and controls
37 lines (34 loc) · 1.34 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
name: Sync Fork
# Mirrors master to the bot account's engine repo (CodeMechanic-Bot/CodeMechanic-Engine).
#
# This used to run on every push, but that target repo does not exist yet, so
# every push failed and sent a failure email. It is now MANUAL-ONLY and skips
# gracefully when the secret or target repo is missing — so it never spams
# failures. To re-enable automatic mirroring: create the CodeMechanic-Engine
# repo under the bot account, ensure BOT_GITHUB_TOKEN can push to it, and add
# the `push:` trigger back below.
on:
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to Bot Fork
env:
BOT_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
if [ -z "$BOT_TOKEN" ]; then
echo "BOT_GITHUB_TOKEN is not set — skipping fork sync."
exit 0
fi
git remote add bot-fork "https://x-access-token:${BOT_TOKEN}@github.com/CodeMechanic-Bot/CodeMechanic-Engine.git"
if git ls-remote bot-fork >/dev/null 2>&1; then
git push bot-fork master --force
else
echo "Target CodeMechanic-Bot/CodeMechanic-Engine not reachable — skipping (create it to enable mirroring)."
exit 0
fi