Diffinery

codician/diffinerypublic

Open-source, agent-first GitHub and GitHub Actions alternative that runs on your own Cloudflare account: git hosting, pull requests, code review and drop-in GitHub Actions YAML on Workers, Durable Objects, R2 and Containers.

2 files changed+10−10
modified.github/workflows/mirror-to-github.yml+4−4View file
@@ -2,7 +2,7 @@
22
33 # Keeps the public copy at github.com/codician-team/diffinery in step with main,
44 # through the deterministic rewrite in scripts/mirror-to-github.sh. Runs on Diffinery
5-# only. Uses GITHUB_MIRROR_TOKEN (a fine-grained GitHub token with Contents and
5+# only. Uses MIRROR_TOKEN (a fine-grained GitHub token with Contents and
66 # Workflows write on that one repository), a secret of the github-mirror environment.
77 # That environment is limited to protected branches, so the token also reaches runs
88 # after an agent's merge. Without the token the job says so and does nothing.
@@ -28,13 +28,13 @@
2828 environment: github-mirror
2929 timeout-minutes: 10
3030 env:
31- GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }}
31+ MIRROR_TOKEN: ${{ secrets.MIRROR_TOKEN }}
3232 steps:
3333 - name: Check the GitHub token
3434 id: token
3535 run: |
36- if [ -z "$GITHUB_MIRROR_TOKEN" ]; then
37- echo "::notice::GITHUB_MIRROR_TOKEN is not set, so GitHub is not updated."
36+ if [ -z "$MIRROR_TOKEN" ]; then
37+ echo "::notice::MIRROR_TOKEN is not set, so GitHub is not updated."
3838 echo "skip=true" >> "$GITHUB_OUTPUT"
3939 fi
4040 - uses: actions/checkout@v4
modifiedscripts/mirror-to-github.sh+6−6View file
@@ -10,7 +10,7 @@
1010 # are mirrored.
1111 #
1212 # Reads Diffinery with DIFFINERY_TOKEN when set (not needed once the repo is public);
13-# MIRROR_SRC can also be a local clone that has main. Pushes with GITHUB_MIRROR_TOKEN
13+# MIRROR_SRC can also be a local clone that has main. Pushes with MIRROR_TOKEN
1414 # when set, otherwise with whatever credentials git already has for github.com.
1515 # Needs git-filter-repo 2.47.0 (pip install git-filter-repo==2.47.0); another
1616 # version could write different commits.
@@ -37,8 +37,8 @@
3737 # The helper reads the token from the environment, so it never lands on a command line.
3838 auth=(-c 'credential.https://diffinery.com.helper=!f() { [ "$1" = get ] && printf "username=x-token\npassword=%s\n" "$DIFFINERY_TOKEN"; }; f')
3939 fi
40-if [ -n "${GITHUB_MIRROR_TOKEN:-}" ]; then
41- auth+=(-c 'credential.https://github.com.helper=!f() { [ "$1" = get ] && printf "username=x-access-token\npassword=%s\n" "$GITHUB_MIRROR_TOKEN"; }; f')
40+if [ -n "${MIRROR_TOKEN:-}" ]; then
41+ auth+=(-c 'credential.https://github.com.helper=!f() { [ "$1" = get ] && printf "username=x-access-token\npassword=%s\n" "$MIRROR_TOKEN"; }; f')
4242 fi
4343 git "${auth[@]}" clone --quiet --bare --single-branch --branch main "$SRC" "$work/repo.git"
4444 cd "$work/repo.git"
@@ -84,8 +84,8 @@
8484 done
8585
8686 # Releases on the mirrored tags get the same name, notes and flags on GitHub (assets aren't copied).
87-# Needs GITHUB_MIRROR_TOKEN for GitHub's API.
88-if [ -n "${GITHUB_MIRROR_TOKEN:-}" ] && [ ${#mirrored[@]} -gt 0 ]; then
87+# Needs MIRROR_TOKEN for GitHub's API.
88+if [ -n "${MIRROR_TOKEN:-}" ] && [ ${#mirrored[@]} -gt 0 ]; then
8989 MIRROR_TAGS="${mirrored[*]}" python3 - <<'PY'
9090 import json, os, urllib.error, urllib.request
9191
@@ -107,7 +107,7 @@
107107 except urllib.error.HTTPError as e:
108108 return e.code, None
109109
110-token = os.environ["GITHUB_MIRROR_TOKEN"]
110+token = os.environ["MIRROR_TOKEN"]
111111 status, me = call("GET", f"{dst.split('/repos/')[0]}/user", token=token)
112112 me = me.get("login") if status == 200 else None
113113 status, releases = call("GET", f"{src}/releases?per_page=100", token=os.environ.get("DIFFINERY_TOKEN"))