Skip to content

mtharrison/github-pr-comment-resource

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cmd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

github-pr-comment-resource

master Release GitHub release report

A resource type for Concourse CI to trigger builds from Github PR comments. Also allows parameters to be provided in comments.

image


Usage

To use register the resource type using the public Docker image mtharrison/github-pr-comment-resource.

resource_types:
 - name: github-pr-comment-resource
   type: docker-image
   source:
     repository: mtharrison/github-pr-comment-resource
     tag: v0.2.0

Then create a new resource using this resource type. You'll need to provide the repository, access_token, optionally a v3_endpoint if you're using Github Enterprise, otherwise this will default to the public Github API.

Optionally you can provide a regex (valid Go regex only). Comments that match this regex only will become new versions. If the regex contains capture groups they will be provided by the resource too.

resources:
 - name: deployment-trigger
   type: github-pr-comment-resource
   icon: github
   source:
     repository: golang/go
     access_token: '[...]'
     v3_endpoint: '[...]'
     regex: '^deploy ([a-zA-Z0-9_.-]+) to ([a-zA-Z0-9_.-]+) please$'

Finally you can use the resource as an input/trigger to any jobs.

jobs:
 - name: deployment-test
   plan:
     - get: deployment-trigger
       trigger: true
     - task: echo
       config:
         image_resource:
           type: registry-image
           source:
             repository: alpine
         inputs:
           - name: deployment-trigger
         platform: linux
         run:
           path: /bin/sh
           args:
             - '-c'
             - |
               apk add jq &> /dev/null
               cat deployment-trigger/comment.json | jq

In the resource directory a comment.json file will be written containing the resource data. See screenshot below:

screenshot