A GitHub Action for triggering a build on a Buildkite pipeline.
- Creates builds in Buildkite pipelines, setting commit, branch, message.
- Provides the build JSON response and the build URL as outputs for downstream actions.
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.
Refer to the action.yml for more detailed information on parameter use.
The action automatically determines the commit author from the GitHub event payload using the following priority order:
.pusher.nameand.pusher.emailfrom the event payload (existing behavior).head_commit.author.nameand.head_commit.author.emailfrom the event payload (for push events).commit.commit.author.nameand.commit.commit.author.emailfrom the event payload (for status events)commit_author_nameandcommit_author_emailinput parameters (user-provided defaults)- Git commit information from the repository (last resort)
Note: Some GitHub events (like status events) don't include a pusher field. The action will automatically fall back through these options to find author information. You can provide default values using the commit_author_name and commit_author_email parameters if the event payload doesn't contain author information.
The following workflow creates a new Buildkite build to the target pipeline on every commit.
on: [push]
steps:
- name: Trigger a Buildkite Build
uses: "buildkite/[email protected]"
with:
buildkite_api_access_token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }}
pipeline: "my-org/my-deploy-pipeline"
branch: "master"
commit: "HEAD"
message: ":github: Triggered from a GitHub Action"
build_env_vars: '{"TRIGGERED_FROM_GHA": "true"}'
build_meta_data: '{"FOO": "bar"}'
ignore_pipeline_branch_filter: true
send_pull_request: true
wait: true
wait_interval: 10
wait_timeout: 300For events without a pusher field (like status events), you can provide default author values:
on: [status]
steps:
- name: Trigger a Buildkite Build
uses: "buildkite/[email protected]"
with:
buildkite_api_access_token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }}
pipeline: "my-org/my-deploy-pipeline"
commit_author_name: ${{ github.event.commit.commit.author.name }}
commit_author_email: ${{ github.event.commit.commit.author.email }}The following outputs are provided by the action:
| Output var | Description |
|---|---|
| url | The URL of the Buildkite build. |
| json | The JSON response returned by the Buildkite API. |
To run the test workflow, you use act which will run it just as it does on GitHub:
act -nTo run the tests locally, use the plugin tester (that has everything already installed) by running the Docker command
docker run --rm -ti -v "$PWD":/plugin buildkite/plugin-tester:v4.0.0- 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.
- Create a new GitHub release. The version numbers in the readme will be automatically updated.
- Support other properties available in the Buildkite Builds REST API, such as environment variables and meta-data.
Contributions welcome! ❤️