name: Mirror "master" and "main" branches
on:
  push:
    branches:
      - master
      - main

jobs:
  mirror:
    runs-on: ubuntu-latest
    steps:
      - name: Partial clone
        run: git clone --bare --depth=100 --single-branch --filter=blob:none ${{ github.event.repository.html_url }} .
      - name: Push
        run: |
          git config http.https://github.com/.extraheader "Authorization: Basic $(echo -n x-access-token:${{ github.token }} | base64 --wrap=0)"
          git push origin HEAD:master HEAD:main

name: Mirror "master" and "main" branches
on:
  push:
    branches:
      - master
      - main

jobs:
  mirror:
    runs-on: ubuntu-latest
    steps:
      - name: Partial clone
        env:
          ref: ${{ github.event.ref }}
        run: git clone --bare --depth=100 --single-branch --branch ${ref#refs/heads/} --filter=blob:none ${{ github.event.repository.html_url }} .
      - name: Push
        run: |
          git config http.https://github.com/.extraheader "Authorization: Basic $(echo -n x-access-token:${{ github.token }} | base64 --wrap=0)"
          git push origin HEAD:master HEAD:main

Fix mirroring `master` to `main`
Fix mirroring `master` to `main`

Previously, we only fetched the default branch, which is now the `main`
branch. But if `master` was advanced, that would fail.

Instead, clone the branch that triggered the event.

Signed-off-by: Johannes Schindelin <53fb8db7833fca1e1746dd8592f61048d350f64c@gmx.de>
