Docs: Update readme
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dorian Zedler 2022-08-08 23:43:31 +02:00
parent 458bc5b4ba
commit 61658b6c82
Signed by: dorian
GPG key ID: 989DE36109AFA354

View file

@ -1,11 +1,16 @@
A plugin to A simple plugin to control GitHub workflows. A plugin to control GitHub workflows.
# Usage # Usage
The following settings changes this plugin's behavior. The following settings change this plugin's behavior.
* param1 (optional) does something. * github_token (required, **secret recommended**) GitHub authentication token.
* param2 (optional) does something different. * 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. Below is an example `.drone.yml` that uses this plugin.
@ -14,12 +19,14 @@ kind: pipeline
name: default name: default
steps: steps:
- name: run itsblue.dev/plugins/github-workflow-controller plugin - name: create workflow_dispatch event
image: itsblue.dev/plugins/github-workflow-controller image: itsblue.dev/plugins/github-workflow-controller
pull: if-not-exists
settings: settings:
param1: foo github_token:
param2: bar from_secret: github-token
github_repo: "foo/bar"
workflow_id: "workflow.yml"
workflow_actions: start
``` ```
# Building # Building
@ -42,11 +49,9 @@ Execute the plugin from your current working directory:
```text ```text
docker run --rm -e PLUGIN_PARAM1=foo -e PLUGIN_PARAM2=bar \ docker run --rm -e PLUGIN_PARAM1=foo -e PLUGIN_PARAM2=bar \
-e DRONE_COMMIT_SHA=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \ -e PLUGIN_GITHUB_TOKEN=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \
-e DRONE_COMMIT_BRANCH=master \ -e PLUGIN_GITHUB_REPO=foo/bar \
-e DRONE_BUILD_NUMBER=43 \ -e PLUGIN_WORKFLOW_ID="workflow.yml" \
-e DRONE_BUILD_STATUS=success \ -e PLUGIN_WORKFLOW_ACTIONS="cancel,delete" \
-w /drone/src \
-v $(pwd):/drone/src \
itsblue.dev/plugins/github-workflow-controller itsblue.dev/plugins/github-workflow-controller
``` ```