You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: run GitLab E2E for labeled fork pull requests (#149)
Fork pull requests currently skip GitLab E2E because `pull_request`
workflows cannot access `GITLAB_TRIGGER_TOKEN`.
Allow maintainers with write access to request the full suite with the
`run-e2e` label. A `pull_request` helper starts the trusted
`workflow_run` handler. The handler checks the labeler, helper file, PR
state, and exact head SHA before it calls GitLab. It does not load fork
code, artifacts, or caches. This flow uses no `pull_request_target`
trigger.
Both workflows must reach `main` before use. The fork branch must
include the unchanged helper. New commits require another review and a
new `run-e2e` label event.
'.state == "open" and .head.sha == $sha and .head.repo.full_name == $head_repo and
120
+
.base.repo.full_name == $repo and .base.ref == "main" and any(.labels[]; .name == "run-e2e")' \
121
+
<<< "$pull_request" > /dev/null; then
122
+
skip_reason='This approval is stale or does not match the PR: check its head, base, and run-e2e label. Review the current commit, then remove and re-add run-e2e to test it.'
123
+
return
124
+
fi
125
+
126
+
should_run=true
127
+
setup_vp_ref="$REQUEST_HEAD_SHA"
128
+
suite=full
129
+
}
56
130
57
131
if [ "$EVENT_NAME" = "pull_request" ]; then
58
132
if [ "$PR_HEAD_REPOSITORY" != "$GITHUB_REPOSITORY" ]; then
59
133
should_run=false
60
-
echo "The workflow skips fork pull requests. The merge queue or a maintainer can test these changes."
134
+
skip_reason='A maintainer with write access can review this fork PR and add the run-e2e label to test its current commit. New commits require removing and re-adding the label. The merge queue also tests the reviewed merge commit.'
61
135
else
62
136
setup_vp_ref="$PR_HEAD_SHA"
63
137
while IFS= read -r changed_path; do
@@ -69,6 +143,8 @@ jobs:
69
143
esac
70
144
done < <(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/files" --jq '.[].filename')
71
145
fi
146
+
elif [ "$EVENT_NAME" = "workflow_run" ]; then
147
+
resolve_fork_request
72
148
elif [ "$EVENT_NAME" = "merge_group" ]; then
73
149
suite=full
74
150
elif [ "$EVENT_NAME" = "workflow_dispatch" ]; then
@@ -90,10 +166,11 @@ jobs:
90
166
} >> "$GITHUB_OUTPUT"
91
167
92
168
if [ "$should_run" = "false" ]; then
169
+
echo "$skip_reason"
93
170
{
94
171
echo "### GitLab E2E"
95
172
echo
96
-
echo "The workflow skipped this fork pull request. The merge queue tests the reviewed merge commit."
Copy file name to clipboardExpand all lines: README.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -419,7 +419,7 @@ setup-vp also provides a GitLab CI/CD remote template hosted from this GitHub re
419
419
420
420
See [GitLab integration notes](rfcs/gitlab-integration.md) for the design background, constraints, and follow-up work.
421
421
422
-
The dedicated [GitLab end-to-end test project](https://gitlab.com/fengmk2/setup-vp-gitlab-test) tests each setup-vp pull request, merge, and release. The pipeline loads the template, bootstrap script, and compiled runtime from the exact setup-vp commit or release tag that it tests.
422
+
The dedicated [GitLab end-to-end test project](https://gitlab.com/fengmk2/setup-vp-gitlab-test) tests same-repository pull requests, approved fork pull requests, merge queue commits, merges, and releases. The pipeline loads the template, bootstrap script, and compiled runtime from the exact setup-vp commit or release tag that it tests.
423
423
424
424
### Basic GitLab Usage
425
425
@@ -689,6 +689,12 @@ vp install
689
689
- Generated files under `dist/` must be committed, including `dist/index.mjs` for the GitHub Action, `dist/gitlab/index.mjs` for the GitLab template, and `dist/azure/index.mjs` for the Azure Pipelines runtime
690
690
- Pre-commit hooks (via husky + lint-staged) will automatically run `vp check --fix` on staged files via `vpx lint-staged`
691
691
692
+
### GitLab E2E for Fork Pull Requests
693
+
694
+
After reviewing the commit, a maintainer with write access can add `run-e2e` to run the full GitLab suite. Approve the Actions run if prompted.
695
+
696
+
For new commits, review the changes and remove and re-add `run-e2e`. Results and the GitLab pipeline link appear in the GitLab E2E workflow summary.
697
+
692
698
### Releasing
693
699
694
700
Releases are published as git tags; there is no npm package, but the `package.json` version tracks the latest release. Consumers pin an exact version tag such as `voidzero-dev/setup-vp@v1.19.0` or a commit SHA. The `v1` major tag is frozen at v1.15.0 and is never moved (an org-level ruleset rejects tag force-pushes).
0 commit comments