fix(ci): handle reviews in branch name lint #2911
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Overview
Updated On: 2025-10-20 13:32:38 UTC
Greptile Summary
This PR fixes a bug in the GitHub Actions workflow where branch name linting fails during
pull_request_reviewevents. The workflow file.github/workflows/tidy3d-python-client-tests.ymlis updated to add a fallback mechanism that extracts the branch name fromgithub.event.pull_request.head.refwhenGITHUB_HEAD_REFis not populated (which occurs during review submissions). The change introduces thePR_BRANCHenvironment variable and checks it before falling back to the existing ref-derived method, ensuring thelint-branch-namejob can correctly validate branch naming conventions across all trigger types (pull requests, reviews, pushes) while maintaining the existing fallback chain for backward compatibility.Important Files Changed
Changed Files
.github/workflows/tidy3d-python-client-tests.ymlConfidence score: 5/5
Sequence Diagram
sequenceDiagram participant User participant GitHub participant DetermineScope as "determine-test-scope" participant Lint as "lint" participant Zizmor as "zizmor" participant BranchLint as "lint-branch-name" participant CommitLint as "lint-commit-messages" participant SchemaVerify as "verify-schema-change" participant LocalTests as "local-tests" participant RemoteTests as "remote-tests" participant PRRequirements as "pr-requirements-pass" User->>GitHub: Pull Request Event (opened/reopened/synchronize/ready_for_review/edited) GitHub->>DetermineScope: Trigger workflow DetermineScope->>GitHub: Check PR approval status via API GitHub-->>DetermineScope: Return reviews and approval state DetermineScope->>DetermineScope: Determine test scope based on event type DetermineScope-->>GitHub: Output test flags (code_quality_tests, pr_review_tests, local_tests, remote_tests) alt code_quality_tests == true GitHub->>Lint: Run linting checks Lint->>Lint: Run ruff format & check Lint-->>GitHub: Lint results GitHub->>Zizmor: Run zizmor security analysis Zizmor->>Zizmor: Analyze workflows and generate SARIF Zizmor->>GitHub: Upload SARIF results Zizmor-->>GitHub: Zizmor results GitHub->>CommitLint: Run commit message linting CommitLint->>CommitLint: Check commit messages with commitlint CommitLint-->>GitHub: Commit lint results GitHub->>SchemaVerify: Verify schema changes SchemaVerify->>SchemaVerify: Install dependencies and regenerate schemas SchemaVerify->>SchemaVerify: Run schema diff against base branch SchemaVerify->>SchemaVerify: Verify allowed changes SchemaVerify-->>GitHub: Schema verification results end alt pr_review_tests == true GitHub->>BranchLint: Run branch name linting BranchLint->>BranchLint: Extract branch name BranchLint->>BranchLint: Enforce Jira key or exempt prefix BranchLint-->>GitHub: Branch lint results end alt local_tests == true GitHub->>LocalTests: Run local tests LocalTests->>LocalTests: Install project with uv LocalTests->>LocalTests: Run pytest with coverage LocalTests->>LocalTests: Generate diff coverage report LocalTests->>GitHub: Post coverage comment to PR LocalTests-->>GitHub: Local test results end alt remote_tests == true GitHub->>RemoteTests: Run remote tests (multi-platform) RemoteTests->>RemoteTests: Install project with poetry RemoteTests->>RemoteTests: Run doctests and pytest with coverage RemoteTests-->>GitHub: Remote test results end GitHub->>PRRequirements: Check all required jobs PRRequirements->>PRRequirements: Validate lint result PRRequirements->>PRRequirements: Validate schema verification result PRRequirements->>PRRequirements: Validate local tests result PRRequirements->>PRRequirements: Validate remote tests result PRRequirements->>PRRequirements: Validate commit message linting result PRRequirements->>PRRequirements: Validate branch name linting result PRRequirements->>PRRequirements: Validate zizmor result PRRequirements-->>GitHub: Final workflow status GitHub-->>User: Workflow completion notification alt Pull Request Review Event (submitted) User->>GitHub: Submit PR review GitHub->>DetermineScope: Trigger workflow Note over DetermineScope: If review is approved, enables remote tests DetermineScope-->>GitHub: Output test flags Note over GitHub: Same test execution flow as above end