mirror of
https://github.com/thegeeklab/wp-github-comment.git
synced 2024-11-22 00:00:42 +00:00
docs: refactor plugin properties
This commit is contained in:
parent
a237020e58
commit
5ce87cc2ed
@ -17,6 +17,29 @@ Drone plugin to add comments to GitHub Issues and Pull Requests.
|
|||||||
<!-- spellchecker-enable -->
|
<!-- spellchecker-enable -->
|
||||||
<!-- prettier-ignore-end -->
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```YAML
|
||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: pr-comment
|
||||||
|
image: thegeeklab/drone-github-comment
|
||||||
|
settings:
|
||||||
|
api_key: ghp_3LbMg9Kncpdkhjp3bh3dMnKNXLjVMTsXk4sM
|
||||||
|
message: "CI run completed successfully"
|
||||||
|
update: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
<!-- spellchecker-disable -->
|
||||||
|
{{< propertylist name=drone-s3-sync.data >}}
|
||||||
|
<!-- spellchecker-enable -->
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
Build the binary with the following command:
|
Build the binary with the following command:
|
||||||
@ -36,7 +59,7 @@ Build the Docker image with the following command:
|
|||||||
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-github-comment .
|
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-github-comment .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Test
|
||||||
|
|
||||||
```Shell
|
```Shell
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
@ -50,23 +73,3 @@ docker run --rm \
|
|||||||
-w $(pwd) \
|
-w $(pwd) \
|
||||||
thegeeklab/drone-github-comment
|
thegeeklab/drone-github-comment
|
||||||
```
|
```
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
api_key
|
|
||||||
: sets api key to access github api
|
|
||||||
|
|
||||||
base_url
|
|
||||||
: sets api url; need to be changed for gh enterprise (default `https://api.github.com`)
|
|
||||||
|
|
||||||
key
|
|
||||||
: sets unique key to assign to comment
|
|
||||||
|
|
||||||
message
|
|
||||||
: sets file or string with comment message
|
|
||||||
|
|
||||||
update
|
|
||||||
: enables update of an existing comment that matches the key
|
|
||||||
|
|
||||||
skip_missing
|
|
||||||
: skips comment creation if the given message file does not exist (default `false`)
|
|
34
_docs/data/data.yaml
Normal file
34
_docs/data/data.yaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
properties:
|
||||||
|
api_key:
|
||||||
|
description: Personal Access token to access the GitHub API.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
base_url:
|
||||||
|
description: API URL. Only need to be changed for GitHub enterprise in most cases
|
||||||
|
defaultValue: https://api.github.com
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
key:
|
||||||
|
description: Unique identifier to assign to a comment. The identifier is used to update an existing comment.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
message:
|
||||||
|
description: File or string that contains the comment text.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
|
update:
|
||||||
|
description: Enables update of an existing comment that matches the key.
|
||||||
|
defaultValue: false
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
|
|
||||||
|
skip_missing:
|
||||||
|
description: Skips comment creation if the given message file does not exist
|
||||||
|
defaultValue: false
|
||||||
|
type: bool
|
||||||
|
required: false
|
@ -11,14 +11,14 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "api-key",
|
Name: "api-key",
|
||||||
EnvVars: []string{"PLUGIN_API_KEY", "GITHUB_COMMENT_API_KEY"},
|
EnvVars: []string{"PLUGIN_API_KEY", "GITHUB_COMMENT_API_KEY"},
|
||||||
Usage: "sets api key to access github api",
|
Usage: "personal access token access github api",
|
||||||
Destination: &settings.APIKey,
|
Destination: &settings.APIKey,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "base-url",
|
Name: "base-url",
|
||||||
EnvVars: []string{"PLUGIN_BASE_URL", "GITHUB_COMMENT_BASE_URL"},
|
EnvVars: []string{"PLUGIN_BASE_URL", "GITHUB_COMMENT_BASE_URL"},
|
||||||
Usage: "sets api url; need to be changed for gh enterprise",
|
Usage: "api url",
|
||||||
Value: "https://api.github.com/",
|
Value: "https://api.github.com/",
|
||||||
Destination: &settings.BaseURL,
|
Destination: &settings.BaseURL,
|
||||||
Category: category,
|
Category: category,
|
||||||
@ -26,28 +26,29 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "key",
|
Name: "key",
|
||||||
EnvVars: []string{"PLUGIN_KEY", "GITHUB_COMMENT_KEY"},
|
EnvVars: []string{"PLUGIN_KEY", "GITHUB_COMMENT_KEY"},
|
||||||
Usage: "sets unique key to assign to comment",
|
Usage: "unique identifier to assign to comment",
|
||||||
Destination: &settings.Key,
|
Destination: &settings.Key,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "message",
|
Name: "message",
|
||||||
EnvVars: []string{"PLUGIN_MESSAGE", "GITHUB_COMMENT_MESSAGE"},
|
EnvVars: []string{"PLUGIN_MESSAGE", "GITHUB_COMMENT_MESSAGE"},
|
||||||
Usage: "sets file or string with comment message",
|
Usage: "file or string that holds the comment text",
|
||||||
Destination: &settings.Message,
|
Destination: &settings.Message,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "update",
|
Name: "update",
|
||||||
EnvVars: []string{"PLUGIN_UPDATE", "GITHUB_COMMENT_UPDATE"},
|
EnvVars: []string{"PLUGIN_UPDATE", "GITHUB_COMMENT_UPDATE"},
|
||||||
Usage: "enables update of an existing comment that matches the key",
|
Usage: "update existing comment that matches the key",
|
||||||
|
Value: false,
|
||||||
Destination: &settings.Update,
|
Destination: &settings.Update,
|
||||||
Category: category,
|
Category: category,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "skip-missing",
|
Name: "skip-missing",
|
||||||
EnvVars: []string{"PLUGIN_SKIP_MISSING", "GITHUB_COMMENT_SKIP_MISSING"},
|
EnvVars: []string{"PLUGIN_SKIP_MISSING", "GITHUB_COMMENT_SKIP_MISSING"},
|
||||||
Usage: "skips comment creation if the given message file does not exist",
|
Usage: "skip creation of comment if message file does not exist",
|
||||||
Value: false,
|
Value: false,
|
||||||
Destination: &settings.SkipMissing,
|
Destination: &settings.SkipMissing,
|
||||||
Category: category,
|
Category: category,
|
||||||
|
Loading…
Reference in New Issue
Block a user