Skip to content

A GitHub Action for triggering a build on a Buildkite pipeline.

License

Notifications You must be signed in to change notification settings

pauldthomson/trigger-pipeline-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trigger Buildkite Pipeline GitHub Action

A GitHub Action for triggering a build on a Buildkite pipeline.

Screenshot of the Trigger Buildkite GitHub Action Node

Features

  • Creates builds in Buildkite pipelines, setting commit, branch, message.
  • Saves the build JSON response to ${HOME}/${GITHUB_ACTION}.json for downstream actions.

Usage

Create a Buildkite API Access Token with write_builds scope, and save it to your GitHub repository’s Settings → Secrets. Then you can configure your Actions workflow with the details of the pipeline to be triggered, and the settings for the build.

For example, the following workflow creates a new Buildkite build on every commit:

workflow "Trigger a Buildkite Build" {
  on = "push"
  resolves = ["Build"]
}

action "Build" {
  uses = "buildkite/[email protected]"
  secrets = ["BUILDKITE_API_ACCESS_TOKEN"]
  env = {
    PIPELINE = "my-org/my-deploy-pipeline"
    COMMIT = "HEAD"
    BRANCH = "master"
    MESSAGE = ":github: Triggered from a GitHub Action"
  }
}

Configuration Options

The following environment variable options can be configured:

Env var Description Default
PIPELINE The pipline to create a build on, in the format <org-slug>/<pipeline-slug>
COMMIT The commit SHA of the build. Optional. $GITHUB_SHA
BRANCH The branch of the build. Optional. $GITHUB_REF
MESSAGE The message for the build. Optional.
BUILD_ENV_VARS Additional environment variables to set on the build, in JSON format. e.g. {"FOO": "bar"}. Optional.

Development

To run the test workflow, you use act which will run it just as it does on GitHub:

act

Contributing

  • Fork this repository
  • Create a new branch for your work
  • Push up any changes to your branch, and open a pull request. Don't feel it needs to be perfect — incomplete work is totally fine. We'd love to help get it ready for merging.

Releasing

  • Create a new GitHub release. The version numbers in the readme will be automatically updated.

Roadmap

  • Add a WAIT option for waiting for the Buildkite build to finish.
  • Support other properties available in the Buildkite Builds REST API, such as environment variables and meta-data.

Contributions welcome! ❤️

About

A GitHub Action for triggering a build on a Buildkite pipeline.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 93.2%
  • Dockerfile 4.1%
  • HCL 2.7%