From 4b177d57e414d9eca6066e9c913c79b5f3643f49 Mon Sep 17 00:00:00 2001 From: Motin Date: Thu, 20 May 2021 09:33:58 +0300 Subject: [PATCH] GitHub action to push browsermt/main branch to mozilla/bergamot-translator every hour (#160) * Create push-browsermt-main-to-mozilla-main.yml * Update .github/workflows/push-browsermt-main-to-mozilla-main.yml Co-authored-by: Graeme * Tweaks * Fix yaml syntax * Parametrized the workflow based on @jerinphilip's example Co-authored-by: Graeme --- .../push-browsermt-main-to-mozilla-main.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/push-browsermt-main-to-mozilla-main.yml diff --git a/.github/workflows/push-browsermt-main-to-mozilla-main.yml b/.github/workflows/push-browsermt-main-to-mozilla-main.yml new file mode 100644 index 0000000..bc0caf6 --- /dev/null +++ b/.github/workflows/push-browsermt-main-to-mozilla-main.yml @@ -0,0 +1,27 @@ +name: Push browsermt/main branch to mozilla/bergamot-translator + +on: + schedule: + # Run every hour + - cron: "0 * * * *" + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + name: Mirror a branch from a remote repo into this one + env: + source_repository: 'browsermt/bergamot-translator' + this_repository: 'mozilla/bergamot-translator' + branch: 'main' + steps: + - uses: actions/checkout@v2 + + - name: Mirror a branch from a remote repo into this one + if: github.repository == '${{ env.this_repository }}' + run: | + git clone -b ${{ env.branch }} https://github.com/${{ env.source_repository }}.git source + cd source + git remote add mirror https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ env.this_repository }}.git + git push mirror ${{ env.branch }}