Dogfood ZTP (#8) #34
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: gitlab-sync | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
permissions: | |
contents: read | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }} | |
env: | |
GITLAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }} | |
GITLAB_PROJECT_ID: ${{ vars.GITLAB_PROJECT_ID }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure git | |
run: | | |
git remote add gitlab https://gitlab-ci-token:${GITLAB_ACCESS_TOKEN}@gitlab.com/boostsecurityio/boostsec-scanner-gitlab.git | |
- name: Synchronize gitlab branch | |
run: | | |
git push --force gitlab HEAD:refs/heads/${BRANCH_NAME} | |
sleep 10 | |
- name: Create merge request | |
run: | | |
.github/scripts/gitlab create | |
- name: Waiting for pipeline | |
run: | | |
.github/scripts/gitlab poll | |
- name: Cleaning up | |
if: always() | |
run: | | |
.github/scripts/gitlab delete || true | |
git push --delete gitlab ${BRANCH_NAME} || true | |