Sync mirrors #15
This file contains 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 mirrors | |
on: | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
env: | |
OWNER: TGAC | |
jobs: | |
repo-sync: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- upstream_repo_owner: jameswilsenach | |
upstream_repo_name: FlowFI | |
upstream_repo_branch: main | |
- upstream_repo_owner: Mills33 | |
upstream_repo_name: Basecall2Assembly | |
upstream_repo_branch: main | |
- upstream_repo_owner: Mills33 | |
upstream_repo_name: QCPipeline | |
upstream_repo_branch: main | |
- upstream_repo_owner: apduncan | |
upstream_repo_name: cvanmf | |
upstream_repo_branch: main | |
name: Sync a repo from upstream | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fork the upstream repo, if necessary | |
run: | | |
if ! git ls-remote "https://github.com/${{ env.OWNER }}/${{ matrix.upstream_repo_name }}"; then | |
gh repo fork "https://github.com/${{ matrix.upstream_repo_owner }}/${{ matrix.upstream_repo_name }}" --clone=false --fork-name="${{ matrix.upstream_repo_name }}" --org="${{ env.OWNER }}" | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.PAT }} | |
- name: Checkout our fork | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ env.OWNER }}/${{ matrix.upstream_repo_name }} | |
token: ${{ secrets.PAT }} # So we can push to it | |
ref: ${{ matrix.upstream_repo_branch }} | |
- name: Pull from the upstream repo and push to our fork | |
run: | | |
git remote add upstream "https://github.com//${{ matrix.upstream_repo_owner }}/${{ matrix.upstream_repo_name }}" | |
git pull upstream "${{ matrix.upstream_repo_branch}}" | |
git push origin "${{ matrix.upstream_repo_branch}}" | |
keepalive-job: | |
name: Keepalive workflow | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gautamkrishnar/keepalive-workflow@v2 |