Integrate gitStream with AI
Required gitStream Plugins
This example requires you to install the askAI
plugin.
Ask AI to Summarize the Changes in a PR
Use AI to generate a concise bullet-point summary of the changes in the pull request.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai summarize"
Automation Actions:
- Add a comment with a summary of the PR
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_summarize:
if:
- {{ pr.labels | match(term="askai summarize") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 📜 PR Summary 📜
{{ source | askAI("Experienced developer",
"Summarize the changes in this PR in bullet points.", env.OPEN_AI_TOKEN) }}
Ask AI to Suggest Tests
Use AI to suggests additional test cases for uncovered or modified functions in the PR, including edge cases.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai tests"
Automation Actions:
- Add a comment with suggested tests generated by an AI model
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_tests:
if:
- {{ pr.labels | match(term="askai tests") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 🧪 Test Suggestions 🧪
{{ source | askAI("QA tester",
"Identify any new or modified functions without test coverage in this PR.
Suggest specific test cases to add, including edge cases.
If all functions are covered, return 'No additional tests needed.'", env.OPEN_AI_TOKEN) }}
Ask AI for a Code Review
Use AI to perform a comprehensive code review, identify bugs, security risks, performance issues, deprecated methods, and style guide violations, and suggests improvements.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai cr"
Automation Actions:
- Add a comment with a code review generated by an AI model
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_review:
if:
- {{ pr.labels | match(term="askai cr") | some }}
run:
- action: add-comment@v1
args:
comment: |
# ✨ gitStream Review ✨
{{ source | askAI("Code reviewer",
"Review the PR code diff.
- Identify bugs, security risks, and performance issues
- Check for deprecated methods and style guide violations
- Provide specific improvement suggestions based on the changes", env.OPEN_AI_TOKEN) }}
Ask AI for Documentation
Use AI to generate a documentation for the newly added features and changes based on the code diff.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai document"
Automation Actions:
- Add a comment with a summary of the PR
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_document:
if:
- {{ pr.labels | match(term="askai document") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 🧪 Test Suggestions 🧪
{{ source | askAI("Technical writer",
"Review the code diff and generate documentation for any newly added features or significant changes.
Focus on describing functionality, parameters, and expected behavior.
Format the output in clear, concise bullet points or paragraphs.", env.OPEN_AI_TOKEN) }}
Ask AI for Code Improvements
Use AI to generate improvement suggestions for the code changes.
Configuration Description
Conditions (all must be true):
- A PR is created or new code has been committed to the PR.
- The PR has a label "askai improve"
Automation Actions:
- Add a comment with omprovement suggestions for the added code
Configuration Example
manifest:
version: 1.0
triggers:
on:
- commit
- pr_created
automations:
ask_ai_improve:
if:
- {{ pr.labels | match(term="askai improve") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 🧪 Test Suggestions 🧪
{{ source | askAI("Experienced developer",
"Review the code diff and suggest improvements to enhance readability, performance, and maintainability.
Focus only on the modified code and provide specific, actionable recommendations.", env.OPEN_AI_TOKEN) }}
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.