Welcome to gitStream
To start using gitStream:
-
Make sure you installed the gitStream app from GitHub marketplace
-
Add the following 2 files into your repo's default branch (usually
masterormain): -
.cm/gitstream.cm .github/workflows/gitstream.yml
Copy-paste from here:
# -*- mode: yaml -*-
manifest:
version: 1.0
# The `automations` section includes a list of automation that applies
# to the repository in which gitStream is installed. Each automation has an
# `if` key with a list of the necessary assertions, as well as a `run` key with a
# list of all actions. All the listed assertions need to pass in order
# for the following actions to be executed (there is AND relation between conditions).
# Each automation under the `automations` section is independent of the others.
# Every time a PR is opened or changed, the automation's conditions are evaluated (the `if`).
# The actions under `run` are executed one by one if all the conditions pass.
# Conditions consists of an expression, which are wrapped with double curly braces, and
# includes a context variable like `files` and filter functions like `length`. Filters
# functions are essentially functions that can be applied to context variables. They are
# called with a pipe operator (|) and can take arguments. Read more on https://docs.gitstream.cm
automations:
# This is the name of the review automation. You can use whatever name, a meaningful name
# will help to identify it in the future. Each automation name in this file should be unique.
estimated_time_to_review:
if:
- true
run:
- action: add-label@v1
args:
label: "{{ calc.etr }} min review"
color: {{ 'E94637' if (calc.etr >= 20) else ('FBBD10' if (calc.etr >= 5) else '36A853') }}
safe_changes:
# The `if` key has a list of conditions, each condition is specified as a Jinja expression
# in a double curly braces. Expressions are evaluated by gitStream on a PR when triggered.
if:
# Given the PR code changes, check that only formatting changes were made
- {{ is.formatting or is.docs or is.tests }}
# `run` key has a list of actions, which are executed one by one whenever the automation
# conditions are met.
run:
# When the changes are validated as formatting only, you can help to speed up the review
# by adding a label that marks it accordingly.
- action: add-label@v1
args:
label: 'safe-changes'
# You can uncomment the following action to get gitStream can even automatically approve
# such PRs to save reviewers time for such changes.
# - action: approve@v1
calc:
etr: {{ branch | estimatedReviewTime }}
is:
formatting: {{ source.diff.files | isFormattingChange }}
docs: {{ files | allDocs }}
tests: {{ files | allTests }}
# Code generated by gitStream GitHub app - DO NOT EDIT
name: gitStream workflow automation
on:
workflow_dispatch:
inputs:
client_payload:
description: The Client payload
required: true
full_repository:
description: the repository name include the owner in `owner/repo_name` format
required: true
head_ref:
description: the head sha
required: true
base_ref:
description: the base ref
required: true
installation_id:
description: the installation id
required: false
resolver_url:
description: the resolver url to pass results to
required: true
resolver_token:
description: Optional resolver token for resolver service
required: false
default: ''
jobs:
gitStream:
timeout-minutes: 5
# uncomment this condition, if you dont want any automation on dependabot PRs
# if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
name: gitStream workflow automation
steps:
- name: Evaluate Rules
uses: linear-b/gitstream-github-action@v1
id: rules-engine
with:
full_repository: ${{ github.event.inputs.full_repository }}
head_ref: ${{ github.event.inputs.head_ref }}
base_ref: ${{ github.event.inputs.base_ref }}
client_payload: ${{ github.event.inputs.client_payload }}
installation_id: ${{ github.event.inputs.installation_id }}
resolver_url: ${{ github.event.inputs.resolver_url }}
resolver_token: ${{ github.event.inputs.resolver_token }}