Automatic Slack Messages
Automatically post positive recognition messages in Slack for well-structured PRs.
Configuration Description
Conditions (all must be true):
- The PR contains updates to tests.
- The PR has fewer than 5 modified files.
- The PR branch references a Jira ticket.
- The PR has fewer than 150 lines of code changed.
Automation Actions:
- Post a Slack message that automatically recognizes the PR author and provides a link to the PR.
Automatic Slack Messages
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
slack_auto_recognition:
if:
- {{ files | match(regex=r/(test|spec)/) | some }} # this pr has at least 1 test
- {{ files | length <= 5 }} # this pr has 5 or less files
- {{ branch.name | includes(regex=r/[A-Z]{2,}-\d+.*/) }} # this branch has the Jira ticket prefix
- {{ branch.diff.size <= 150 }} # this branch has 150 lines of code or less changed
run:
- action: send-slack-message@v1
args:
webhook_url: "{{ env.SLACK_WEBHOOK }}"
message: ":tada: Congrats to {{ pr.author }} for the amazing new PR, '{{ pr.title }}'! Check it out at https://github.com/{{ repo.owner }}/{{ repo.name }}/pull/{{ pr.number }}"
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.