-
Notifications
You must be signed in to change notification settings - Fork 16
38 lines (38 loc) · 1.73 KB
/
push-pr-to-gitlab.yaml
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
name: Push the PR to the home Project at MPCDF's gitlab
on:
pull_request_target:
paths-ignore:
- '.gitlab-ci.*'
- '.github/**'
jobs:
push-to-gitlab:
runs-on: ubuntu-latest
env:
gitlab_ref: "github-${{ github.event.pull_request.number }}-${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.head.ref }}"
steps:
- name: Git checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: ${{ github.event.pull_request.head.sha }}
- name: Git push
run: |
git push "https://username:${{ secrets.GITLAB_ACCESS_TOKEN }}@gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR.git" HEAD:refs/heads/$gitlab_ref -f
- name: Create MR
run: |
curl -X POST -L -G \
--header "PRIVATE-TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}" \
--data-urlencode "source_branch=$gitlab_ref" \
--data-urlencode "target_branch=develop" \
--data-urlencode "title=GitHub PR: ${{ github.event.pull_request.title }}" \
--data-urlencode "description=Original pull request on GitHub: ${{ github.event.pull_request.html_url }}" \
--data-urlencode "remove_source_branch=true" \
gitlab.mpcdf.mpg.de/api/v4/projects/2187/merge_requests
- name: Comment PR
uses: mshick/add-pr-comment@v2
with:
message: |
A merge request has been opened on gitlab. View the [GitLab merge requests](https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR/-/merge_requests).
This will run CI/CD pipelines, we will continue the discussion, and
merge on GitLab. After the merge has completed on GitLab, the changes will
be pushed to `develop` here.