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 with Origin Repository | |
on: | |
repository_dispatch: | |
types: | |
- sync | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
env: | |
TARGET_BRANCH: ${{ github.event.client_payload.target_branch }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Add Organization Repository as Remote | |
run: | | |
git remote add org-repo https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/DangleDangle/dangledangle-client.git | |
- name: Fetch Changes from Organization Repository | |
run: | | |
git fetch org-repo ${{env.TARGET_BRANCH}} | |
git branch -D ${{env.TARGET_BRANCH}} || git checkout -b ${{env.TARGET_BRANCH}} | |
git reset --hard "org-repo/${{ env.TARGET_BRANCH }}" | |
git push origin ${{env.TARGET_BRANCH}} -f |