Merge pull request #18 from RIKEN-RCCS/develop #466
This file contains hidden or 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 protected branches to GitLab | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Push protected branches and tags to GitLab | |
| env: | |
| GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
| GITLAB_REPO: ${{ secrets.GITLAB_REPO }} | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-bot" | |
| git config user.email "bot@example.com" | |
| git remote add gitlab https://oauth2:${GITLAB_TOKEN}@${GITLAB_REPO} | |
| git fetch origin +refs/heads/develop:refs/remotes/origin/develop +refs/heads/main:refs/remotes/origin/main | |
| git push -o ci.skip gitlab refs/remotes/origin/develop:refs/heads/develop refs/remotes/origin/main:refs/heads/main --force | |
| git push -o ci.skip gitlab --tags --force |