diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000..e148ea4 --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,27 @@ +name: Mirror +on: + push: + branches: ["main", "dev"] + schedule: + - cron: '0 0 * * *' + workflow_dispatch: +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Git credentials + run: | + git config --global user.name "Mirror Sync Action" + git config --global user.email ${{ secrets.MIRROR_EMAIL }} + - name: Add mirror remote + run: | + if git remote get-url mirror; then + echo "Mirror remote already exists" + else + git remote add mirror https://${{ secrets.MIRROR_PAT }}@github.com/ImperialCollegeLondon/matlab-repo-init.git + fi + - run: git fetch mirror + - if: true + name: Push to mirror + run: git push --mirror mirror