Skip to content

Commit

Permalink
Merge pull request #1 from farmersdog/setup
Browse files Browse the repository at this point in the history
Set up Dockerfile
  • Loading branch information
rfarine authored Sep 14, 2020
2 parents 42e2e15 + d50bb27 commit 959a2db
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Credit: https://www.sethvargo.com/writing-github-actions-in-go/
#
# Step 1
#

FROM golang:1.15 AS builder

# Install upx (upx.github.io) to compress the compiled action
RUN apt-get update && apt-get -y install upx

# Turn on Go modules support and disable CGO
ENV GO111MODULE=on CGO_ENABLED=0

COPY . .

RUN go build \
-a \
-trimpath \
-ldflags "-s -w -extldflags '-static'" \
-installsuffix cgo \
-tags netgo \
-o /bin/action \
.

# Strip any symbols - this is not a library
RUN strip /bin/action

# Compress the compiled action
RUN upx -q -9 /bin/action


# Step 2

# Use the most basic and empty container - this container has no
# runtime, files, shell, libraries, etc.
FROM scratch

# Copy over SSL certificates from the first step - this is required
# if our code makes any outbound SSL connections because it contains
# the root CA bundle.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Copy over the compiled action from the first step
COPY --from=builder /bin/action /bin/action

# Specify the container's entrypoint as the action
ENTRYPOINT ["/bin/action"]
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# clubhouse-pr
# ClubHouse Pull Request Github Action

Insert description here, Rae.

## Inputs

### `ch-id`

**Required** The Clubhouse story ID (ie. '[ch0]')

## Outputs

### `pr-title`

The title of the pull request

## Example usage

uses: actions/clubhouse-pr@v1
with:
pr-title: '[ch0]'
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'Clubhouse Pull Request'
description: 'Populate PR fields with Clubhouse story information'
inputs:
ch-id:
description: 'Clubhouse ID (ie. [ch0])'
required: true
default: '[ch0]'
outputs:
pr-title:
description: 'Pull Request Title from Clubhouse'
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.ch-id }}
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/farmersdog/clubhouse-pr

go 1.15

require github.com/sethvargo/go-githubactions v0.2.0 // indirect
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/sethvargo/go-githubactions v0.2.0 h1:CKdUfKUJvqqYz7/7l36K2DmsP5JZPycnvjfT5Ae7BVE=
github.com/sethvargo/go-githubactions v0.2.0/go.mod h1:ugCoIFQjs7HxIwwYiY7ty6H9T+7Z4ey481HxqA3VRKE=
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import "github.com/sethvargo/go-githubactions"

func main() {
chId := githubactions.GetInput("ch-id")

if chId == "" {
githubactions.Fatalf("missing input 'ch-id'")
}

// TODO: will want to use this for some inputs:
// githubactions.AddMask(fruit)
}

0 comments on commit 959a2db

Please sign in to comment.