Skip to content

Commit 8b24c9f

Browse files
authored
Merge branch 'main' into dheesen-patch-1
2 parents f92f9fa + a699bce commit 8b24c9f

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Sync PR to GitLab
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
7+
jobs:
8+
sync-pr-to-gitlab:
9+
if: github.event.label.name == 'sync-to-gitlab'
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
GITLAB_REPO_URL: ${{ secrets.GITLAB_REPO_URL }} # bv. https://gitlab.com/elgentos/magento2-playwright.git
14+
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} # GitLab Personal Access Token (api scope)
15+
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }} # Numeriek project ID uit GitLab
16+
GITLAB_API_URL: ${{ secrets.GITLAB_API_URL }} # bv. https://gitlab.com/api/v4
17+
GITLAB_TARGET_BRANCH: ${{ secrets.GITLAB_TARGET_BRANCH }} # bv. main
18+
19+
steps:
20+
- name: Set defaults
21+
id: defaults
22+
run: |
23+
# Fallbacks als secrets niet gezet zijn
24+
if [ -z "$GITLAB_API_URL" ]; then
25+
echo "GITLAB_API_URL=https://gitlab.com/api/v4" >> $GITHUB_ENV
26+
fi
27+
28+
if [ -z "$GITLAB_TARGET_BRANCH" ]; then
29+
echo "GITLAB_TARGET_BRANCH=main" >> $GITHUB_ENV
30+
fi
31+
32+
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
33+
echo "PR_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
34+
echo "PR_URL=${{ github.event.pull_request.html_url }}" >> $GITHUB_ENV
35+
echo "PR_BRANCH=github-pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
36+
37+
- name: Checkout PR head (unmerged)
38+
uses: actions/checkout@v4
39+
with:
40+
ref: refs/pull/${{ github.event.pull_request.number }}/head
41+
fetch-depth: 0
42+
43+
- name: Push branch to GitLab
44+
run: |
45+
if [ -z "$GITLAB_REPO_URL" ]; then
46+
echo "GITLAB_REPO_URL secret is not set"; exit 1;
47+
fi
48+
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
52+
echo "Adding GitLab remote: $GITLAB_REPO_URL"
53+
git remote add gitlab "$GITLAB_REPO_URL"
54+
55+
echo "Pushing branch to GitLab as $PR_BRANCH"
56+
git push gitlab HEAD:"$PR_BRANCH" --force
57+
58+
- name: Create Merge Request on GitLab
59+
run: |
60+
if [ -z "$GITLAB_PROJECT_ID" ]; then
61+
echo "GITLAB_PROJECT_ID secret is not set"; exit 1;
62+
fi
63+
64+
TITLE="GitHub PR #$PR_NUMBER: $PR_TITLE"
65+
DESCRIPTION="Deze Merge Request is automatisch aangemaakt vanuit GitHub PR #$PR_NUMBER ($PR_URL)."
66+
67+
echo "Creating MR on GitLab:"
68+
echo " Project ID: $GITLAB_PROJECT_ID"
69+
echo " Source: $PR_BRANCH"
70+
echo " Target: $GITLAB_TARGET_BRANCH"
71+
72+
curl --fail -X POST "$GITLAB_API_URL/projects/$GITLAB_PROJECT_ID/merge_requests" \
73+
--header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
74+
--data-urlencode "source_branch=$PR_BRANCH" \
75+
--data-urlencode "target_branch=$GITLAB_TARGET_BRANCH" \
76+
--data-urlencode "title=$TITLE" \
77+
--data-urlencode "description=$DESCRIPTION" \
78+
--data "remove_source_branch=true" \
79+
--data "labels=github,external"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ npx playwright test –-grep-invert @coupon-code
203203

204204
### Customizing the testing suite
205205

206-
The newly created `tests` folder will become your base of operations. In here, you should use the same folder structure that you see in `base-tests`. For example, if your login page works slightly differently from the demo website version, create a copy of `login.page.ts` and place it `tests/config/poms/frontend/` and make your edits in this file. The next time you run the testing suite, it will automatically use these custom files.
206+
The newly created `tests` folder will become your base of operations. In here, you should use the same folder structure that you see in `base-tests`. For example, if your login page works slightly differently from the demo website version, create a copy of `login.page.ts` and place it `tests/poms/frontend/` and make your edits in this file. The next time you run the testing suite, it will automatically use these custom files.
207207

208208
#### Module Imports
209209

0 commit comments

Comments
 (0)