1
1
mirror of https://github.com/drone-plugins/github-actions synced 2024-11-15 02:56:25 +01:00
Run github action as a drone plugin
Go to file
Jim Sheldon 87c917b4e7 update act to v0.2.34
this also required updating the action image to node16

this is a potentially breaking change, so I don't think we want this plugin
image to be tagged 'latest' if/when this change is merged to main

I have also updated the drone pipeline to only publish the image on tag
events, so if we give a proper tag (maybe 2.0.0) this updated plugin image
will be available as plugins/github-actions:2 which will not break existing
pipelines pulling latest
2022-12-22 13:24:48 -05:00
cmd update act to v0.2.34 2022-12-22 13:24:48 -05:00
daemon Added webhook support 2021-10-18 00:02:56 +05:30
docker update act to v0.2.34 2022-12-22 13:24:48 -05:00
pkg/encoder Added webhook support 2021-10-18 00:02:56 +05:30
scripts Working github actions 2021-09-27 10:48:58 +05:30
utils Added support for env & secrets 2021-10-07 18:04:00 +05:30
.drone.yml update act to v0.2.34 2022-12-22 13:24:48 -05:00
.gitignore Working github actions 2021-09-27 10:48:58 +05:30
go.mod (maint) move to harness.drone.io 2022-12-07 14:42:15 +00:00
go.sum (maint) move to harness.drone.io 2022-12-07 14:42:15 +00:00
plugin.go Added webhook support 2021-10-18 00:02:56 +05:30
README.md fixed readme 2021-10-07 17:40:34 +05:30

drone-github-action-plugin

This plugin allows running github actions as a drone plugin.

Build

Build the binaries with the following commands:

export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on

go build -v -a -tags netgo -o release/linux/amd64/plugin   ./cmd

Docker

Build the Docker images with the following commands:

docker build \
  --label org.label-schema.build-date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
  --label org.label-schema.vcs-ref=$(git rev-parse --short HEAD) \
  --file docker/Dockerfile.linux.amd64 --tag plugins/github-actions .

Plugin step usage

Provide uses, with & env of github action to use in plugin step settings. Provide GITHUB_TOKEN as environment variable if it is required for an action.

steps:
- name: github-action
  image: plugins/github-actions
  settings:
    uses: actions/hello-world-javascript-action@v1.1
    with:
        who-to-greet: Mona the Octocat
    env:
        hello: world

Running locally

  1. Running actions/hello-world-javascript-action action locally via docker:

 docker run --rm \
    --privileged \
    -v $(pwd):/drone \
    -w /drone \
    -e PLUGIN_USES="actions/hello-world-javascript-action@v1.1" \
    -e PLUGIN_WITH="{\"who-to-greet\":\"Mona the Octocat\"}" \
    -e PLUGIN_VERBOSE=true \
    plugins/github-actions