A simple plugin to control GitHub workflows
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Dorian Zedler 61658b6c82
Docs: Update readme
2 months ago
docker Chore: initial commit 2 months ago
plugin Chore: initial commit 2 months ago
scripts Chore: initial commit 2 months ago
.drone.yml Chore: initial commit 2 months ago
.drone.yml.multiarch Chore: initial commit 2 months ago
.gitignore Chore: initial commit 2 months ago
LICENSE.md Chore: initial commit 2 months ago
README.md Docs: Update readme 2 months ago
go.mod Chore: initial commit 2 months ago
go.sum Chore: initial commit 2 months ago
main.go Chore: initial commit 2 months ago

README.md

A plugin to control GitHub workflows.

Usage

The following settings change this plugin's behavior.

  • github_token (required, secret recommended) GitHub authentication token.
  • github_repo (required) the repo to act on.
  • workflow_id (required) the workflow to act on, eg workflow.yml.
  • workflow_actions (required) the actions to execute, one or more (separated by ,) of:
    • start: starts the workflow by creating a workflow_dispatch event
    • cancel: cancels all queued and running workflows
    • delete: deletes all completed workflow runs

Below is an example .drone.yml that uses this plugin.

kind: pipeline
name: default

steps:
- name: create workflow_dispatch event
  image: itsblue.dev/plugins/github-workflow-controller
  settings:
    github_token:
      from_secret: github-token
    github_repo: "foo/bar"
    workflow_id: "workflow.yml"
    workflow_actions: start

Building

Build the plugin binary:

scripts/build.sh

Build the plugin image:

docker build -t itsblue.dev/plugins/github-workflow-controller -f docker/Dockerfile .

Testing

Execute the plugin from your current working directory:

docker run --rm -e PLUGIN_PARAM1=foo -e PLUGIN_PARAM2=bar \
  -e PLUGIN_GITHUB_TOKEN=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \
  -e PLUGIN_GITHUB_REPO=foo/bar \
  -e PLUGIN_WORKFLOW_ID="workflow.yml" \
  -e PLUGIN_WORKFLOW_ACTIONS="cancel,delete" \
  itsblue.dev/plugins/github-workflow-controller