Files
nixpkgs/.github/workflows/mirror-nixpkgs.yml
T

34 lines
1.0 KiB
YAML

name: Mirror Nixpkgs Branches
on:
schedule:
- cron: "0 0 * * 2"
workflow_dispatch:
permissions:
contents: write
jobs:
mirror:
runs-on: ubuntu-latest
steps:
- name: Mirror upstream branches
env:
NIX_BRANCH_TOKEN: ${{ secrets.NIX_BRANCH_TOKEN }}
TARGET_REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
: "${NIX_BRANCH_TOKEN:?Set the NIX_BRANCH_TOKEN repository secret.}"
git clone --bare --single-branch --branch nixos-26.05 \
"https://github.com/NixOS/nixpkgs.git" nixpkgs.git
git -C nixpkgs.git fetch origin \
"refs/heads/nixos-unstable:refs/heads/nixos-unstable"
git -C nixpkgs.git remote add target \
"https://x-access-token:${NIX_BRANCH_TOKEN}@github.com/${TARGET_REPOSITORY}.git"
for branch in nixos-26.05 nixos-unstable; do
git -C nixpkgs.git push --force target \
"refs/heads/$branch:refs/heads/$branch"
done