-
Notifications
You must be signed in to change notification settings - Fork 11
54 lines (50 loc) · 1.97 KB
/
gitlab-sync-main-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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"