Skip to content

Commit

Permalink
Merge pull request #153 from markcallen/chore/gitstream
Browse files Browse the repository at this point in the history
Added gitstream
  • Loading branch information
markcallen authored Apr 30, 2023
2 parents 51bfe35 + a5789c4 commit e951ae3
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .cm/gitstream.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- mode: yaml -*-
# This example configuration for provides basic automations to get started with gitStream.
# View the gitStream quickstart for more examples: https://docs.gitstream.cm/quick-start/
manifest:
version: 1.0
automations:
# Add a label that indicates how many minutes it will take to review the PR.
estimated_time_to_review:
if:
- true
run:
- action: add-label@v1
# etr is defined in the last section of this example
args:
label: "{{ calc.etr }} min review"
color: {{ 'E94637' if (calc.etr >= 20) else ('FBBD10' if (calc.etr >= 5) else '36A853') }}
# Post a comment that lists the best experts for the files that were modified.
code_experts:
if:
- true
run:
- action: add-comment@v1
# More info about explainCodeExperts: https://docs.gitstream.cm/filter-functions/#explaincodeexperts
args:
comment: |
{{ repo | explainCodeExperts(gt=10) }}
# The next function calculates the estimated time to review and makes it available in the automation above.
calc:
etr: {{ branch | estimatedReviewTime }}
49 changes: 49 additions & 0 deletions .github/workflows/gitstream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Code generated by gitStream GitHub app - DO NOT EDIT

name: gitStream workflow automation
run-name: |
/:\ gitStream: PR #${{ fromJSON(fromJSON(github.event.inputs.client_payload)).pullRequestNumber }} from ${{ github.event.inputs.full_repository }}
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 }}

0 comments on commit e951ae3

Please sign in to comment.