Skip to content

Commit

Permalink
Add sync-public.yaml (#287)
Browse files Browse the repository at this point in the history
* Add sync-public.yaml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add sync-public-develop.yaml

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
kenji-miyake authored Sep 14, 2021
1 parent 30590ef commit 7a6dacd
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/sync-public-develop.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
40 changes: 40 additions & 0 deletions .github/workflows/sync-public.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 7a6dacd

Please sign in to comment.