GitHub Actions
The Trigger GitHub Action automation provides the ability to integrate with GitHub Actions. For example, when a card is moved to a certain lane, a GitHub action could be triggered that creates a build and deploys it to a test environment.
- The Owner field determines the owner of the repository that contains the desired GitHub action. This field can either be a fixed value or can pull the value from a custom field on the triggering card.
- The Repository field determines the name of the repository that contains the desired GitHub action. This field can either be a fixed value or can pull the value from a custom field on the triggering card. The Owner field and Repository field are combined to determine the location of the code like:
https://github.com/myowner/myrepository
.
- The Event Type field is a fixed value that is used as the event_type property in a repository_dispatch request to GitHub. Read more about the repository_dispatch here. The event type allows you to target different workflows in a single repostitory. A workflow file in GitHub would specify the event types that it is triggered on like:
on: repository_dispatch: types: [deploy-new-build]
- The Access Token field is used to specify a Personal Access Token. This value is stored securely and never returned back to the client. If needed, the Replace Token button can be used to provide a new token at any time.
- To create a Personal Access Token in GitHub, under your user, go to Settings, then Developer Settings, then Personal Access Token. If using a classic access token, then you will need to ensure that the token has at least the workflow scope checked. If creating a Fine-grained token, then ensure that the token has Access: Read and Write selected for the Contents category.
- When triggering a GitHub action, a client_payload is provided that gives the workflow access to contextual information from the automation that was triggered. The client_payload looks like:
{ "automation": { "description": "Deploy build to dev environment", "id": "9805319955" }, "card": { "customFields": [ { "fieldId": "9807193330", "label": "branch-name", "type": "text", "value": "feature-new-search" }, { "fieldId": "9807186486", "label": "project-name", "type": "choice", "value": "PROJ1" } ], "customFieldsByLabel": { "branch-name": "feature-new-search", "project-name": "PROJ1" }, "externalCardId": "external-123", "externalLink": { "label": "external system link", "url": "https://external-system.dev/123" }, "id": "970188846", "laneId": "954694361", "title": "Enhancements to search box", "url": "https://mycompany.leankit.com/card/970188846" }, "event": "movedTo", "eventData": { "movedFromLaneId": "954694354" }, "eventDate": "2023-02-23T19:59:47.887Z", "host": "https://mycompany.leankit.com" }
- A workflow file could reference any of the client_payload information as part of its processing. For example, to access a value from the card's custom field, the workflow could use
${{ github.event.client_payload.customFieldsByLabel.branch-name }}
.
- While in a workflow triggered by an AgilePlace automation, it may be useful to make calls back into AgilePlace to either retrieve additional details or to make updates to the card. For example, a comment could be added with a link to the GitHub Action workflow run, a card could be moved to another lane when the workflow is completed, or a card could be blocked if there is an error or the card does not contain necessary information. AgilePlace provides a number of standard GitHub Actions that can be used for this purpose in this repository: https://github.com/LeanKit/github-actions with further documentation and examples.