Skip to content

Conversation

mahlau-flex
Copy link
Contributor

@mahlau-flex mahlau-flex commented Oct 6, 2025

Added a new job to the github CI pipeline, which checks if the branch name contains a Jira key. Currently, this check runs only in the pull-request phase (I am not sure if this is correct or the check should also be applied in other stages).

The check can be overriden if the branch name starts with "hotfix" or "chore".

Greptile Overview

Updated On: 2025-10-06 13:00:32 UTC

Summary

This PR adds a GitHub Actions workflow job that enforces Jira issue key requirements in branch names during pull requests. The implementation introduces a new `lint-branch-name` job that validates branch names contain a Jira key pattern (`[A-Z]{2,}-[0-9]+`) while allowing exemptions for branches starting with "hotfix" or "chore".

The job integrates seamlessly with the existing CI pipeline by adding itself to the workflow dependencies and failure conditions. It extracts the branch name from GitHub's context (github.head_ref), performs case-insensitive prefix checking for exemptions, and uses bash regex matching to validate the Jira pattern. The implementation only runs during pull request events (github.event_name == 'pull_request'), ensuring it doesn't interfere with merge operations or other workflow triggers.

This change supports development governance by ensuring all feature work can be traced back to specific Jira tickets, improving project management and change tracking capabilities. The exemption system acknowledges that emergency fixes and maintenance work may not always require formal ticket creation.

PR Description Notes:

  • Contains a minor typo: "overriden" should be "overridden"

Important Files Changed

Changed Files
Filename Score Overview
.github/workflows/tidy3d-python-client-tests.yml 4/5 Added Jira key validation job for pull request branch names with hotfix/chore exemptions

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it only adds validation without breaking existing functionality
  • Score reflects well-structured implementation with proper error handling and clear exemption logic
  • Pay attention to the workflow integration points to ensure the job properly fails the CI when branch names don't comply

Sequence Diagram

sequenceDiagram
    participant User
    participant GitHub as "GitHub (PR Event)"
    participant CI as "CI Pipeline"
    participant BranchLinter as "Branch Name Linter"
    participant TestScope as "Test Scope Determiner"
    participant Lint as "Code Linter"
    participant Schema as "Schema Verifier"
    participant LocalTest as "Local Tests"
    participant RemoteTest as "Remote Tests"
    participant Requirements as "PR Requirements Check"

    User->>GitHub: "Create Pull Request"
    GitHub->>CI: "Trigger PR workflow"
    
    CI->>TestScope: "Determine test scope"
    TestScope->>TestScope: "Check approval state"
    TestScope->>TestScope: "Set local_tests and remote_tests flags"
    
    par Branch Name Check
        CI->>BranchLinter: "Check branch name for Jira key"
        BranchLinter->>BranchLinter: "Extract branch name"
        BranchLinter->>BranchLinter: "Check for exempt prefixes (hotfix, chore)"
        alt Branch has Jira key or exempt prefix
            BranchLinter->>CI: "✅ Branch name valid"
        else Branch missing Jira key
            BranchLinter->>CI: "❌ Branch name invalid"
        end
    and Code Linting
        CI->>Lint: "Run linting checks"
        Lint->>Lint: "Run ruff format and check"
        Lint->>CI: "Linting results"
    and Schema Verification
        CI->>Schema: "Verify schema changes"
        Schema->>Schema: "Regenerate schemas"
        Schema->>Schema: "Check if committed schemas match"
        Schema->>Schema: "Validate version for schema changes"
        Schema->>CI: "Schema verification results"
    and Local Tests
        alt local_tests == true
            CI->>LocalTest: "Run local tests"
            LocalTest->>LocalTest: "Install dependencies"
            LocalTest->>LocalTest: "Run pytest with coverage"
            LocalTest->>LocalTest: "Generate diff coverage report"
            LocalTest->>CI: "Local test results"
        end
    and Remote Tests
        alt remote_tests == true
            CI->>RemoteTest: "Run remote tests"
            RemoteTest->>RemoteTest: "Install project dependencies"
            RemoteTest->>RemoteTest: "Run doctests and full test suite"
            RemoteTest->>CI: "Remote test results"
        end
    end
    
    CI->>Requirements: "Check all job results"
    Requirements->>Requirements: "Validate lint, schema, tests, and branch name"
    
    alt All checks pass
        Requirements->>GitHub: "✅ PR requirements met"
        GitHub->>User: "PR ready for merge"
    else Any check fails
        Requirements->>GitHub: "❌ PR requirements not met"
        GitHub->>User: "Fix issues before merge"
    end
Loading

Context used:

Rule from dashboard - Do not use markdown formatting in exception or warning messages; use single quotes to highlight vari... (source)

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

github-actions bot commented Oct 6, 2025

Diff Coverage

Diff: origin/develop...HEAD, staged and unstaged changes

No lines with coverage information in this diff.

Copy link
Contributor

@frederikschubertflex frederikschubertflex left a comment

Choose a reason for hiding this comment

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

If this is only run for pull requests, would a fallback to the PR title also suffice? It also allows us to connect the PR and Jira issue but is less effort that renaming the branch.

@mahlau-flex mahlau-flex force-pushed the FXC-3387-Enforce-Jira-issue-keys-in-branch-names-via-CI branch from 6f76ca0 to cecf288 Compare October 7, 2025 08:41
@mahlau-flex mahlau-flex changed the title feat: added jira key enforcement for pr ci: added jira key enforcement for pr Oct 7, 2025
@mahlau-flex mahlau-flex force-pushed the FXC-3387-Enforce-Jira-issue-keys-in-branch-names-via-CI branch 2 times, most recently from a66a2f5 to 35deb34 Compare October 7, 2025 08:48
@mahlau-flex
Copy link
Contributor Author

@frederikschubertflex I have added the fallback to the PR-title

Copy link
Collaborator

@yaugenst-flex yaugenst-flex left a comment

Choose a reason for hiding this comment

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

Thanks @mahlau-flex! I think this is good, but just noticed it will conflict with dependabot: https://github.com/flexcompute/tidy3d/pull/2801/commits

We should add an exemption for daily-chore/ too.

@mahlau-flex mahlau-flex force-pushed the FXC-3387-Enforce-Jira-issue-keys-in-branch-names-via-CI branch from 35deb34 to 128931d Compare October 7, 2025 10:20
@mahlau-flex
Copy link
Contributor Author

Thanks @mahlau-flex! I think this is good, but just noticed it will conflict with dependabot: https://github.com/flexcompute/tidy3d/pull/2801/commits

We should add an exemption for daily-chore/ too.

I have added the daily-chore exemption 👍

@yaugenst-flex yaugenst-flex added this pull request to the merge queue Oct 7, 2025
Any commits made after this event will not be merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants