test(update_self): verify the tool is reached through the background … #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Joi Lab Fork Mirror | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| sync: | |
| if: github.repository == 'razzant/ouroboros' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Push branches to Joi Lab fork | |
| env: | |
| MIRROR_PAT: ${{ secrets.JOILAB_FORK_MIRROR_PAT }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${MIRROR_PAT:-}" ]; then | |
| echo "JOILAB_FORK_MIRROR_PAT is not configured" >&2 | |
| exit 1 | |
| fi | |
| git fetch origin +refs/heads/*:refs/remotes/origin/* | |
| git remote add joi-lab "https://x-access-token:${MIRROR_PAT}@github.com/joi-lab/ouroboros.git" | |
| git push --force joi-lab origin/ouroboros:refs/heads/ouroboros | |
| git push --force joi-lab origin/ouroboros-stable:refs/heads/ouroboros-stable | |
| git push --force joi-lab origin/legacy-google-colab:refs/heads/legacy-google-colab | |
| git checkout -B mirror-main origin/main | |
| python3 - <<'PY' | |
| from pathlib import Path | |
| path = Path("README.md") | |
| text = path.read_text(encoding="utf-8") | |
| notice = """> [!IMPORTANT] | |
| > This repository is an active mirror of the official Ouroboros repository: | |
| > **https://github.com/razzant/ouroboros** | |
| > | |
| > Please open issues, discussions, and release questions in `razzant/ouroboros`. | |
| > Open pull requests against its lowercase `ouroboros` branch and follow `CONTRIBUTING.md` there. | |
| """ | |
| if not text.startswith("> [!IMPORTANT]\n> This repository is an active mirror"): | |
| path.write_text(notice + text, encoding="utf-8") | |
| PY | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "Mirror notice for Joi Lab fork" || true | |
| git push --force joi-lab mirror-main:refs/heads/main |