Skip to content

Integrate gitStream with RDoc

Integrate gitStream with RDoc: a documentation generation framework for Ruby.

Review RDoc Changes

Approve PRs that only contain changes to RDoc and assign optional reviewers.

Review RDoc

Configuration Description

Conditions (all must be true):

  • The PR only contains changes to RDoc content.

Automation Actions:

  • Assign the org/tech-writers team for optional review.
  • Apply a green 📓 RDoc Only label
  • Approve the PR

Review RDoc

# -*- mode: yaml -*-
manifest:
  version: 1.0
automations:
  review_rdoc:
    if:
      - {{ source.diff.files | match(attr='diff', regex=r/^[\s\t]*#.*/) | every }}
    run:
      - action: add-label@v1
        args:
            label: "📓RDoc Only"
            color: {{ colors.green }}
      - action: add-reviewers@v1
        args:
          reviewers: [org/tech-writers]
      - action: approve@v1

colors:
  green: '0e8a16'

Enforce RDoc Requirements for New Classes

Require RDoc for all new Ruby classes.

Enforce RDoc for New Ruby Classes

Configuration Description

Conditions (all must be true):

  • The PR creates a new Ruby class.
  • The PR lacks RDoc content.

Automation Actions:

  • Request changes and post a comment explaining that RDoc is required
  • Apply a yellow ⚠️ Missing RDoc label.

Enforce RDoc for New Ruby Classes

# -*- mode: yaml -*-
manifest:
  version: 1.0
automations:
  review_rdoc_new_class: 
    if:  
      - {{ is.rb and is.new }} 
      - {{ source.diff.files | match(attr='diff', regex=r/(\#.*\n.*)*def/) | nope }}
    run:
      - action: add-label@v1
        args:
          label: "⚠️ Missing RDoc"
          color: {{ colors.yellow }}
      - action: add-comment@v1
        args: 
          comment: | 
            RDoc is required for all Ruby classes. Please add documentation for this PR.

is:
    rb: {{ files | extensions | match(regex=r/rb/) | every }}
    new: {{ source.diff.files | map(attr='original_file') | match(regex=r/^$/) | some }}

colors:
  yellow: 'fbca04'

Review RDoc for Large changes

Require more extensive reviews for large Ruby changes that lack RDoc updates.

Review RDoc for Large changes

Configuration Description

Conditions (all must be true):

  • The PR changes more than 150 lines of Ruby code.

Automation Actions:

  • Post a comment asking the author to review all relevant RDoc to identify necessary updates.
  • Require a review from the ORG/tech-writers team.
  • Apply a yellow ⚠️ Missing RDoc Label

Review RDoc

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  #Require more extensive reviews for large Ruby changes that lack RDoc updates.
  review_rdoc_large:
    if:
      - {{ changes.additions > 150}}
      - {{ source.diff.files | matchDiffLines(regex=r/(\#.*\n.*)*def/) | nope }}
    run: 
      - action: add-label@v1
        args:
          label: "⚠️ Missing RDoc"
          color: {{ colors.yellow }}
      - action: add-comment@v1
        args: 
          comment: | 
              This PR makes major changes to Ruby methods, but is missing updates to RDoc. Please double check for any necessary RDoc updates.
      - action: add-reviewers@v1
        args:
          reviewers: [fourth-organization/tech-writers]

changes:
  # Sum all the lines added/edited in the PR
  additions: {{ branch.diff.files_metadata | map(attr='additions') | sum }}


colors:
  yellow: 'fbca04'

Review RDoc For Function Parameter Changes

Warn PR authors when they change Ruby function or constructor input parameters without updating RDoc content.

Review RDoc Input Parameters

Configuration Description

Conditions (all must be true):

  • The PR changes one or more input parameters in Ruby methods.
  • The PR lacks RDoc updates.

Automation Actions:

  • Post a comment warning the user to review the method’s RDoc to identify necessary updates.

Review RDoc Input Parameters

# -*- mode: yaml -*-
manifest:
  version: 1.0
automations:
  review_rdoc_input: 
    if:  
      - {{ source.diff.files | match(attr='diff', regex=r/(\#.*\n.*)*def/) | nope }}
      - {{ source.diff.files | match(attr='diff', regex=r/def.*\(.*\)/ | some }}
    run:
    - action: add-comment@v1
      args: 
        comment: | 
            This PR modifies method input parameters, but is missing RDoc changes. Please check to ensure no RDoc changes are necessary.

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

More Automations can be found on the Automation Library and Integrations pages.

Special thanks to Boemo W Mmopelwa for providing these examples.