Integrate gitStream with Godoc
Review Godoc Changes
Approve PRs that only contain changes to Godoc and assign optional reviewers.
Configuration Description
Conditions (all must be true):
- The PR only contains changes to Godoc content.
Automation Actions:
- Assign the org/tech-writers team for optional review.
- Apply a green
📓 Godoc Only
label - Approve the PR
Review Godoc
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
#Assign PRs that only affect godocs to the technical writing team and add docs label
review_godoc:
if:
- {{ source.diff.files | match(attr='diff', regex=r/^\/\/.*/) | every }}
- {{ files | extensions | match(regex=r/go/) | every }}
run:
- action: add-label@v1
args:
label: "📓godoc Only"
color: {{ colors.green }}
- action: add-reviewers@v1
args:
reviewers: [org/tech-writers]
- action: approve@v1
colors:
green: '0e8a16'
Enforce Godoc Requirements for New Classes
Require Godoc for all new Golang classes.
Configuration Description
Conditions (all must be true):
- The PR creates a new Golang class.
- The PR lacks Godoc content.
Automation Actions:
- Request changes and post a comment explaining that Godoc is required
- Apply a yellow
⚠️ Missing Godoc
label.
Enforce Godoc for New Golang Classes
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
review_godoc_new_class:
if:
- {{ is.go and is.new }}
- {{ source.diff.files | match(attr='diff', regex=r/\/*[\s\S]*?\//) | nope }}
run:
- action: add-label@v1
args:
label: "⚠️ Missing godoc"
color: {{ colors.yellow }}
- action: add-comment@v1
args:
comment: |
godoc is required for all Golang classes. Please add godoc to all new classes in this PR.
is:
go: {{ files | extensions | match(regex=r/go/) | every }}
new: {{ source.diff.files | map(attr='original_file') | match(regex=r/^$/) | some }}
colors:
yellow: 'fbca04'
Review Godoc for Large changes
Require more extensive reviews for large Golang changes that lack Godoc updates.
Configuration Description
Conditions (all must be true):
- The PR changes more than 100 lines of Golang code.
Automation Actions:
- Post a comment asking the author to review all relevant Godoc to identify necessary updates.
- Require a review from the
ORG/tech-writers
team. - Apply a yellow
⚠️ Missing Godoc
Label
Review Godoc
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
#Require more extensive reviews for large Golang changes that lack Godoc updates.
review_godoc_large:
if:
- {{ changes.additions > 100}}
- {{ source.diff.files | matchDiffLines(regex=r/^\/\/.*/) | nope }}
run:
- action: add-label@v1
args:
label: "⚠️ Missing Godoc"
color: {{ colors.yellow }}
- action: add-comment@v1
args:
comment: |
This PR makes major changes to Golang classes, but is missing updates to Godoc. Please double check for any necessary Godoc 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'
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.