From 7a6dacde9ebfae762fad7d44f227d059644c00ed Mon Sep 17 00:00:00 2001 From: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Date: Tue, 14 Sep 2021 12:09:45 +0900 Subject: [PATCH] Add sync-public.yaml (#287) * Add sync-public.yaml Signed-off-by: Kenji Miyake * Add sync-public-develop.yaml Signed-off-by: Kenji Miyake --- .github/workflows/sync-public-develop.yaml | 40 ++++++++++++++++++++++ .github/workflows/sync-public.yaml | 40 ++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 .github/workflows/sync-public-develop.yaml create mode 100644 .github/workflows/sync-public.yaml diff --git a/.github/workflows/sync-public-develop.yaml b/.github/workflows/sync-public-develop.yaml new file mode 100644 index 0000000000000..9676ab05be865 --- /dev/null +++ b/.github/workflows/sync-public-develop.yaml @@ -0,0 +1,40 @@ +name: sync public + +on: + schedule: + - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: + +env: + BASE_BRANCH: develop + SYNC_TARGET_BRANCH: develop-internal + SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal.proj.git + +jobs: + sync-public: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ env.BASE_BRANCH }} + fetch-depth: 0 + + - name: Generate token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' + + - name: Push to public repository + run: | + git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} + git fetch public + git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }} diff --git a/.github/workflows/sync-public.yaml b/.github/workflows/sync-public.yaml new file mode 100644 index 0000000000000..9e421c74434fc --- /dev/null +++ b/.github/workflows/sync-public.yaml @@ -0,0 +1,40 @@ +name: sync public + +on: + schedule: + - cron: "0 19 * * *" # run at 4 AM JST + workflow_dispatch: + +env: + BASE_BRANCH: main + SYNC_TARGET_BRANCH: main-internal + SYNC_TARGET_REPOSITORY: https://github.com/tier4/AutowareArchitectureProposal.proj.git + +jobs: + sync-public: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + ref: ${{ env.BASE_BRANCH }} + fetch-depth: 0 + + - name: Generate token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + + - name: Set git config for private repositories + run: | + git config --local --unset-all http.https://github.com/.extraheader || true + git config --global url.https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com.insteadOf 'https://github.com' + + - name: Push to public repository + run: | + git remote add public ${{ env.SYNC_TARGET_REPOSITORY }} + git fetch public + git push public ${{ env.BASE_BRANCH }}:${{ env.SYNC_TARGET_BRANCH }}