Github Actions

Usage

By default Github Actions can not be triggered via the API. To enable Sleuth to trigger the workflow, you need to add workflow_dispatch option in on section:
1
# Controls when the action will run.
2
on:
3
# Triggers the workflow on push or pull request events
4
# but only for the master branch
5
push:
6
branches: [ master ]
7
pull_request:
8
branches: [ master ]
9
10
# Allows Sleuth to triggered the workflow through API
11
workflow_dispatch:
Copied!
The only required parameter for Sleuth is the name of the workflow file located in your repository ./github/workflows/ folder. Sleuth will pass any additional specified parameters to Github Actions API when triggering the build in case your workflow requires additional input parameters. See Github Actions documentation for additional informations.
This example triggers a deploy-prod workflow in Github when code is deployed to the "Staging" environment for more than 4 hours and is healthy:
1
rules:
2
- run-deploy:
3
conditions:
4
- environment='Staging'
5
- deployed_for>'4h'
6
- health='Healthy'
7
actions:
8
- trigger_build:
9
parameters:
10
name: 'deploy-prod.yml'
11
my-custom-non-required-param: 'we are going live'
Copied!
Last modified 5mo ago
Copy link