Skip to content

Mirror react-router-busy to Own Repo #87

Mirror react-router-busy to Own Repo

Mirror react-router-busy to Own Repo #87

name: Mirror react-router-busy to Own Repo
on:
push:
schedule:
# Only sync to destination once a week
- cron: '0 0 * * 0'
pull_request_target:
# TODO Call when a PR affecting this package is merged or release is made
jobs:
mirror:
# Just don't run push in monorepo since we use cron there
# Still run on push in destination repo since it might be needed
# Note PR opened in dest repo pushes commit to source repo and now it's not run, doesn't seem to matter but if it does check actor
# And when PR merged in source, it still closes PR in destination but doesn't update destination repo
# Need to make sure only runs in mono and react-router-busy, not other mirrors
# But also could just not mirror these actions to others
# "54: Nothing to do in the SoT repo except for push events."
# if: (github.repository == 'bitofbreeze/mono' || github.repository == 'bitofbreeze/react-router-busy') && (github.event_name != 'push' || github.repository != 'bitofbreeze/mono') && (github.event_name != 'pull_request_target' || github.repository != 'bitofbreeze/mono')
runs-on: ubuntu-latest
steps:
# TODO Not working in PR that this was added in
- name: Log
run: echo "event name is:" ${{ github.event_name }}
- name: Log 2
run: echo "event type is:" ${{ github.event.action }}
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Copybara
uses: bitofbreeze/copybara-action@main
with:
access_token: ${{ secrets.COPY_GITHUB_REPO_TOKEN }}
ssh_key: ${{ secrets.COPY_SSH_KEY_RR_BUSY }}
sot_repo: bitofbreeze/mono
destination_repo: bitofbreeze/react-router-busy
# Explicitly include patches that are used since CI fails if it tries to patch a package that isn't a dependency
push_files: "glob(['**'], exclude = ['apps/**', 'packages/**', '.github/workflows/*.yml', 'patches/**']) + glob(['packages/react-router-busy/**', '.github/workflows/packages.react-router-busy.*.yml', 'patches/patch-package+*.patch'])"
# Only do SQUASH for initial mirror creation
push_mode: "ITERATIVE"
# Make sure to always remove init-history after first copybara push, else PRs created in destination will fail the workflow since --init-history is not compatible with CHANGE_REQUEST
# copybara_options: --init-history
# GitHub allows showing another README by default that is in .github https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes
# Also need to move license to show in GitHub main preview
# Nope doesn't work .github/LICENSE.md||packages/react-router-busy/LICENSE.md
pr_move: |
.github/README.md||packages/react-router-busy/README.md