Skip to content

feat(python-cli-parity): centralize pull request context - #1771

Open
John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
refactor/ci-pr-context
Open

John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
refactor/ci-pr-context

Conversation

@jdalton

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

Copy link
Copy Markdown
Contributor

Summary

Socket now gets its GitHub pull request details in one place. It reads the request number and the branch where the change will go. It also reads the commit ID. That ID points to the saved code that the change is based on.

If the job has no commit ID, Socket looks for it in the file GitHub sends with the job.

This gives #1772 a place to add GitLab and Azure. It also gives #1766 the details it needs to find the right scan to compare.

Slides

Put GitHub pull request details in one place. One part of Socket reads the details that scan jobs need about a GitHub pull request.

What Socket reads from GitHub. Pull request number. Which proposed change is the build checking? Target branch. Where will that change go? Commit ID. Which saved version of the code is it based on?

Where Socket looks for the commit ID. Build settings. Socket checks the value GitHub gives to the build. GitHub event file. If that value is missing, Socket looks in the file GitHub sends with the job.

@cursor

cursor Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Refactor of CI env parsing with equivalent PR-number behavior for scans; new async file read only runs on GitHub PR workflows when base SHA env is absent.

Overview
Introduces detectCiPullRequestContext as the single place to read GitHub Actions PR metadata: PR number from GITHUB_REF, optional base branch (GITHUB_BASE_REF), and base commit SHA (GITHUB_BASE_SHA, with a fallback that parses GITHUB_EVENT_PATH when the SHA env var is missing).

handle-ci drops the inlined detectCiPullRequestNumber helper and awaits the new detector; behavior for scan creation is unchanged today because only number is still passed through as pullRequest. The expanded fields are positioned for follow-up PRs that will consume baseline metadata.

Tests now target the full CiPullRequestContext shape and restore all relevant GitHub env vars between cases. .gitignore is updated to track the new module.

Reviewed by Cursor Bugbot for commit 6a86193. Configure here.

This branch has not been deployed

No deployments
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.

2 participants