Merge pull request #384 from team-monite/changeset-release/main #21
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 main with GitLab | |
on: | |
# Avoid using `pull_request_target`, to prevent insecure actions | |
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
push: | |
branches: | |
- main | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.pull_request.number }}" | |
# Cancel in-progress runs when a new workflow with the same group name is triggered | |
cancel-in-progress: true | |
jobs: | |
sync-branch-with-gitlab: | |
name: Sync GitHub main branch with GitLab MR branch | |
environment: gitlab | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sync PR with GitLab | |
uses: team-monite/sync-gitlab-repo-submodule-action@1335a83ed6c174eb7b3f477a6915d7d0d9a1f526 | |
with: | |
action: sync-branch | |
gitlab_token: ${{ secrets.GITLAB_TOKEN }} | |
gitlab_host: ${{ secrets.GITLAB_HOST }} | |
gitlab_project_id: ${{ secrets.GITLAB_PROJECT_ID }} | |
gitlab_target_branch: ${{ secrets.GITLAB_TARGET_BRANCH }} | |
submodule_name: ${{ secrets.GITLAB_SUBMODULE_NAME }} | |
branch: ${{ github.ref_name }} | |
sha: ${{ github.sha }} | |
merge-gitlab-mr: | |
needs: sync-branch-with-gitlab | |
name: Merge GitLab MR | |
environment: gitlab | |
runs-on: ubuntu-latest | |
env: | |
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
GITLAB_HOST: ${{ secrets.GITLAB_HOST }} | |
GITLAB_PROJECT: ${{ secrets.GITLAB_PROJECT }} | |
steps: | |
- name: Merge GitLab MR | |
uses: team-monite/sync-gitlab-repo-submodule-action@1335a83ed6c174eb7b3f477a6915d7d0d9a1f526 | |
with: | |
action: merge-mr | |
gitlab_token: ${{ secrets.GITLAB_TOKEN }} | |
gitlab_host: ${{ secrets.GITLAB_HOST }} | |
gitlab_project_id: ${{ secrets.GITLAB_PROJECT_ID }} | |
gitlab_target_branch: ${{ secrets.GITLAB_TARGET_BRANCH }} | |
submodule_name: ${{ secrets.GITLAB_SUBMODULE_NAME }} | |
branch: ${{ github.ref_name }} | |
sha: ${{ github.sha }} | |
gitlab_merge_when_pipeline_succeeds: "true" |