Skip to content

feat(python-cli-parity): detect pull requests in GitLab and Azure - #1768

Merged
John-David Dalton (jdalton) merged 1 commit into
refactor/ci-pr-contextfrom
jdalton/surf-2240-ci-pr-context
Nov 25, 2026
Merged

John-David Dalton (jdalton) merged 1 commit into
refactor/ci-pr-contextfrom
jdalton/surf-2240-ci-pr-context

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Teams that use GitLab or Azure Pipelines can run socket ci without copying pull request details by hand. Socket reads the number and the branch the change will go into. GitLab calls the change a merge request.

On GitLab, Socket also reads the saved version of the code used for the comparison, if GitLab gives it one. On Azure, this change reads the request number and branch. GitHub Actions still works.

This builds on the shared GitHub code in #1771. The follow-up in #1772 also cleans up Azure branch names.

Slides

Find GitLab and Azure pull requests. Socket can tell when a GitLab or Azure build is checking a proposed code change.

What Socket reads. GitLab. It reads the merge request number, where the change will go, and the saved version to compare against when GitLab gives it one. Azure Pipelines. It reads the pull request number and where the change will go.

What this adds to the build. Run socket ci. Socket reads the pull request details that GitLab or Azure gives to the build. GitHub Actions. GitHub pull request builds still use the same details as before.

@cursor

cursor Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Isolated CI env-var parsing with additive GitLab/Azure support; GitHub path is refactored but behavior-preserving and covered by existing and new tests.

Overview
Extends socket ci so scans can pick up a pull/merge request number outside GitHub Actions. Detection is centralized in detectCiPullRequestContext, which returns both the PR number and a provider (github, gitlab, or azure).

GitHub behavior is unchanged: the number still comes from GITHUB_REF (refs/pull/<n>/…). GitLab uses CI_MERGE_REQUEST_IID; Azure Pipelines uses SYSTEM_PULLREQUEST_PULLREQUESTNUMBER with a fallback to SYSTEM_PULLREQUEST_PULLREQUESTID. Invalid or zero values yield { number: 0, provider: undefined }.

handle-ci.mts wires the detected number into handleCreateNewScan via pullRequest, and detectCiPullRequestNumber remains a thin wrapper over the new helper. Unit tests cover all three providers plus malformed env values; .gitignore is updated so the new CI files are tracked.

Reviewed by Cursor Bugbot for commit 27bb633. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 27bb633. Configure here.

@jdalton John-David Dalton (jdalton) changed the title feat(python-cli-parity): detect GitLab and Azure PR context feat(python-cli-parity): detect pull requests in GitLab and Azure Nov 25, 2026
@jdalton
John-David Dalton (jdalton) changed the base branch from v1.x to refactor/ci-pr-context November 25, 2026 22:42
@jdalton
John-David Dalton (jdalton) merged commit a240b76 into refactor/ci-pr-context Nov 25, 2026
9 of 21 checks passed
@jdalton
John-David Dalton (jdalton) deleted the jdalton/surf-2240-ci-pr-context branch November 25, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant