forked from kostis-codefresh/github-pr-comment-step
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pr-comment-plugin.yml
106 lines (97 loc) · 3.19 KB
/
pr-comment-plugin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
version: '1.0'
kind: step-type
metadata:
name: dashhudson/github-pr-comment
isPublic: false
description: >-
This pipeline plugin adds comments to GitHub pull requests
sources:
- 'https://github.com/dashhudson/github-pr-comment-step'
stage: incubating
maintainers:
- name: Kostis Kapelonis
categories:
- git
official: false
tags: []
icon:
type: svg
url: https://cdn.worldvectorlogo.com/logos/github.svg
background: '#f4f4f4'
examples:
- description: automatic-comment-pr
workflow:
version: '1.0'
steps:
add_commenton_current_pr_from_trigger:
title: Adding comment on this PR
type: dashhudson/github-pr-comment
fail_fast: false
arguments:
PR_COMMENT_TEXT: 'Your staging environment is ready at http://example.com/${{CF_BRANCH_TAG_NORMALIZED}}/preview'
GIT_PROVIDER_NAME: 'github'
- description: commment-on-specific-pr
workflow:
version: '1.0'
steps:
add_pr_comment_directly:
title: Adding comment on another PR
type: dashhudson/github-pr-comment
fail_fast: false
arguments:
PR_COMMENT_TEXT: 'Example comment on PR 45'
GIT_PROVIDER_NAME: 'github'
CF_PULL_REQUEST_NUMBER: 45
latest: true
version: 1.0.1
spec:
arguments: |-
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"patterns": [],
"required": [
"GIT_PROVIDER_NAME",
"PR_COMMENT_TEXT"
],
"optional": [
"CF_PULL_REQUEST_NUMBER"
],
"properties": {
"CF_PULL_REQUEST_NUMBER": {
"type": "number",
"description": "Github pull request number (Automatically set in PR trigger events)"
},
"PR_COMMENT_TEXT": {
"type": "string",
"description": "Text body of the comment to be created"
},
"GIT_PROVIDER_NAME": {
"type": "string",
"description": "Name of git provider to use from Codefresh integrations screen"
}
}
}
steps:
get_github_token:
title: "Get token"
image: quay.io/codefresh/cli:latest
environment:
- GIT_PROVIDER_NAME=${{GIT_PROVIDER_NAME}}
commands:
- export GITHUB_TOKEN=$(codefresh get context $GIT_PROVIDER_NAME --decrypt -o yaml | yq -r -c .spec.data.auth.password)
- echo GITHUB_TOKEN=$GITHUB_TOKEN >> /meta/env_vars_to_export
create_pr_comment:
title: "Write comment"
image: 540628134787.dkr.ecr.us-west-2.amazonaws.com/github-commenter:latest
environment:
- GITHUB_OWNER=${{CF_REPO_OWNER}}
- GITHUB_REPO=${{CF_REPO_NAME}}
- GITHUB_COMMENT_TYPE=pr
- GITHUB_PR_ISSUE_NUMBER=${{CF_PULL_REQUEST_NUMBER}}
- GITHUB_COMMENT=${{PR_COMMENT_TEXT}}
- GITHUB_DELETE_COMMENT_REGEX="Your preview environment"
commands:
- github-commenter