GitHub app installation
Installation
Note
Make sure gitStream app is installed in GitHub.
Step 1 of 2: Create a .cm/gitstream.cm
rules file in your repository default branch (usually master
or main
) with the following contents:
# -*- mode: yaml -*-
manifest:
version: 1.0
automations:
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') }}
code_experts:
if:
- true
run:
- action: add-comment@v1
args:
comment: |
{{ repo | explainCodeExperts(gt=10) }}
calc:
etr: {{ branch | estimatedReviewTime }}
Step 2 of 2: Create a .github/workflows/gitstream.yml
action file in your repository default branch (usually master
or main
) with the following contents:
# 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
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 }}
Next steps
To learn how to add your first rule, jump to the Quick Start page.
Tip
To allow gitStream blocking PRs from merging under certain conditions, set gitStream as required check.
Configuration files
Eventually, the following files should exist in each of the selected repos:
File and path | Reason |
---|---|
.cm/*.cm | Under the repo's .cm directory, any file that ends with .cm will be used by gitStream to specify automation rules, you can edit these files |
.github/workflows/gitstream.yml | Used by gitStream to execute automation rules in your GitHub repo so source code doesn't get to outside services |
Permissions
The required permissions are:
Permissions | Reason |
---|---|
Write access to dedicated gitStream app files | Used to set up the gitStream workflow files |
Write access to code | To allow gitStream to approve PRs once all conditions are met |
Read access to administration, issues, and metadata | To get the user team membership, and branch protection settings |
Read and write access to actions, checks, pull requests, and workflows | Trigger workflows, create and update pull requests and their checks, and modify workflow files |
User email | Used to identify users |