linear-b / gitstream

/:\ gitStream - Workflow automation for your git repo. Use YAML to auto-assign reviewers, auto-merge PRs, automatic PR labeler, and more.
https://gitstream.cm
Apache License 2.0
267 stars 32 forks source link

Fix Branched-Based Review Policies Doc #584

Closed cghyzel closed 1 month ago

cghyzel commented 1 month ago
gitstream-cm[bot] commented 1 month ago

A screenshot of the relevant part of docs after the changes is a life saver 🛟

gitstream-cm[bot] commented 1 month ago

✨gitStream Describe PR ✨

The changes in this pull request include:

  1. Documentation Update:

    • In the README file for branch management automation, the section titled "Assign Reviewers Based on Target Branch" has been renamed to "Branch-Based Review Policies." This section now also includes a reference to a separate file containing examples of this automation.
  2. Configuration File Updates:

    • In the review_source_branch.cm configuration file:

      • The entries for branch automation have been rearranged so that the name field comes before the prefix field.
    • In the review_target_branch.cm configuration file:

      • A similar rearrangement of fields has been done, with name now preceding prefix.
      • Each branch entry now includes a reviewers field that specifies which team is responsible for reviewing PRs targeting certain branches, such as org/release-team for the Release branch and org/experiment-team for the Experimental branch. Prior, these fields were either not listed or incorrectly aligned with other entries.
gitstream-cm[bot] commented 1 month ago

📜 PR Summary 📜

gitstream-cm[bot] commented 1 month ago

✨ gitStream Review ✨

From the provided diffs, only cm (gitStream Configuration) files are relevant as there are no js file changes. Here is the review of the cm files:

review_source_branch.cm

  1. Bug/Consistency:

    • The keys under branches are now structured consistently with both name and prefix fields. This update addresses any inconsistency present in the previous versions regarding the key ordering.
  2. Performance:

    • No performance issues identified within this configuration file as it primarily deals with setup logic.
  3. Best Practices:

    • The use of a regular expression (prefix) for branch matching is an efficient approach and considered a best practice.
    • Correct use of templating with adequate safety checks ({% for item in branches %}) is positive.
  4. Improvement Suggestions:

    • Ensure that the regex patterns are adequately tested to match the intended branches and don't accidentally match unintended ones.
    • Review the logic for setting approvals and the actual add-reviewers@v1 action to ensure they are aligned with organizational policy or changes in the team structure.

review_target_branch.cm

  1. Bug/Consistency:

    • The file has been updated to consistently include name, prefix, and reviewers for branches. This provides a cleaner data structure and better maintainability.
  2. Performance:

    • Regular expressions are used efficiently; ensure the patterns efficiently match the correct branches without performance drawbacks.
  3. Best Practices:

    • The structured approach of including mandatory reviewers in the configuration allows for centralized control and is in line with best practices.
  4. Improvement Suggestions:

    • Check that the reviewer assignments (reviewers: org/release-team and reviewers: org/experiment-team) reflect current team membership to keep review processes up to date.
    • Consistent use of naming conventions in automation naming (e.g., review_target_branch_{{ item.name }}) can improve clarity.
    • Consider expanding comments within the YAML for documentation purposes, particularly for complex regexes or specific logic choices, to aid future maintainers.

No security risks are apparent in the changes, but ensure that the data in reviews and reviewers variables sourced from any external input is validated and sanitized.