Woodpecker CI Plugins
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

wp-github-comment

Build Status Docker Hub Quay.io Go Report Card GitHub contributors Source: GitHub License: MIT

Woodpecker CI plugin to add comments to GitHub Issues and Pull Requests.

Usage

Due to the nature of this plugin, a secret for the GitHub token may need to be exposed for pull request events in Woodpecker. Please be careful with this option, as a malicious actor may submit a pull request that exposes your secrets. Do not disclose secrets to pull requests in public environments without further protection.
Only pull request events are supported by this plugin. Running the plugin on other events will result in an error.
steps:
  - name: pr-comment
    image: quay.io/thegeeklab/wp-github-comment
    settings:
      api_key: ghp_randomstring
      message: "CI run completed successfully"
      update: true

Parameters

api_key required string
Personal access token to access the GitHub API.
Default: none
base_url optional string

Api url.

Only need to be changed for GitHub enterprise in most cases.

Default: https://api.github.com/
key optional string

Unique identifier to assign to a comment.

The identifier is used to update an existing comment.

Default: none
message required string
Path to file or string that contains the comment text.
Default: none
skip_missing optional bool
Skip comment creation if the given message file does not exist.
Default: false
update optional bool
Enable update of an existing comment that matches the key.
Default: false

Build

Build the binary with the following command:

make build

Build the container image with the following command:

docker build --file Containerfile.multiarch --tag thegeeklab/wp-github-comment .

Test

docker run --rm \
  -e CI_PIPELINE_EVENT=pull_request \
  -e CI_REPO_OWNER=octocat \
  -e CI_REPO_NAME=foo \
  -e CI_COMMIT_PULL_REQUEST=1
  -e PLUGIN_API_KEY=ghp_randomstring \
  -e PLUGIN_MESSAGE="Demo comment" \
  -v $(pwd):/build:z \
  -w /build \
  thegeeklab/wp-github-comment