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.

51 lines · 1.8 KBRaw History
1name: Mirror to GitHub
2
3# Keeps the public copy at github.com/codician-team/diffinery in step with main,
4# 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
6# Workflows write on that one repository), a secret of the github-mirror environment.
7# That environment is limited to protected branches, so the token also reaches runs
8# after an agent's merge. Without the token the job says so and does nothing.
9on:
10 push:
11 branches: [main]
12 schedule:
13 - cron: "23 */6 * * *"
14 workflow_dispatch:
15
16permissions:
17 contents: read
18
19concurrency:
20 group: mirror-to-github
21 cancel-in-progress: false
22
23jobs:
24 mirror:
25 name: Push main to the GitHub mirror
26 if: ${{ github.server_url != 'https://github.com' && github.repository == 'codician/diffinery' }}
27 runs-on: ubuntu-latest
28 environment: github-mirror
29 timeout-minutes: 10
30 env:
31 GITHUB_MIRROR_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }}
32 steps:
33 - name: Check the GitHub token
34 id: token
35 run: |
36 if [ -z "$GITHUB_MIRROR_TOKEN" ]; then
37 echo "::notice::GITHUB_MIRROR_TOKEN is not set, so GitHub is not updated."
38 echo "skip=true" >> "$GITHUB_OUTPUT"
39 fi
40 - uses: actions/checkout@v4
41 if: steps.token.outputs.skip != 'true'
42 with:
43 ref: main
44 fetch-depth: 0
45 - if: steps.token.outputs.skip != 'true'
46 # Pinned: another filter-repo version could write different commits.
47 run: python3 -m pip install --quiet --break-system-packages git-filter-repo==2.47.0 || python3 -m pip install --quiet git-filter-repo==2.47.0
48 - if: steps.token.outputs.skip != 'true'
49 run: scripts/mirror-to-github.sh
50 env:
51 MIRROR_SRC: ${{ github.workspace }}