GitHub Action: atmos-affected-trigger-spacelift
GitHub Action for Triggering Affected Spacelift Stacks
Introduction
warning
Deprecated. Migrate to Atmos Native CI.
This action is deprecated, along with the rest of the Spacelift integration it depends on. See the migration guide at https://atmos.tools/deprecated/github-actions/atmos-affected-trigger-spacelift for how to move to Atmos Native CI.
This repo contains a GitHub Action that determines the affected Atmos stacks for a PR, then creates a comment on the PR which Spacelift can use to trigger the corresponding stacks via a push policy.
Optionally, you can use the spacectl trigger method, which uses the spacectl CLI to trigger the corresponding
spacelift stacks directly rather than via comment/push policy.
Usage
name: Pull Request
on:
pull_request:
branches: [ 'main' ]
types: [opened, synchronize, reopened, closed, labeled, unlabeled]
jobs:
context:
runs-on: ubuntu-latest
steps:
- name: Atmos Affected Stacks Trigger Spacelift (via comment)
uses: cloudposse/github-action-atmos-affected-trigger-spacelift@main
id: example
with:
atmos-config-path: ./rootfs/usr/local/etc/atmos
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Atmos Affected Stacks Trigger Spacelift (direct)
uses: cloudposse/github-action-atmos-affected-trigger-spacelift@main
id: example
with:
atmos-config-path: ./rootfs/usr/local/etc/atmos
github-token: ${{ secrets.GITHUB_TOKEN }}
trigger-method: spacectl
spacelift-endpoint: https://unicorn.app.spacelift.io
spacelift-api-key-id: ${{ secrets.SPACELIFT_API_KEY_ID }}
spacelift-api-key-secret: ${{ secrets.SPACELIFT_API_KEY_SECRET }}
Inputs
| Name | Description | Default | Required |
|---|---|---|---|
| atmos-config-path | A path to the folder where atmos.yaml is located | . | false |
| atmos-include-dependents | Whether to include dependents of affected stacks in the output | false | false |
| atmos-include-settings | Include the settings section for each affected component | false | false |
| atmos-include-spacelift-admin-stacks | Whether to include the Spacelift admin stacks of affected stacks | true | false |
| atmos-stack | The stack to operate on | false | |
| atmos-version | The version of atmos to install if install-atmos is true | latest | false |
| base-ref | The base ref to checkout. If not provided, the head default branch is used. | N/A | false |
| default-branch | The default branch to use for the base ref. | ${{ github.event.repository.default_branch }} | false |
| deploy | A flag to indicate if a deployment should be triggered. If false, a preview will be triggered. | false | false |
| filter-by-workspace-enabled | Filter out stacks where settings.spacelift.workspace_enabled is false. When enabled, only stacks with workspace_enabled not explicitly set to false will be triggered or posted in PR comments. | false | false |
| github-token | A GitHub token for running the spacelift-io/setup-spacectl action | N/A | true |
| head-ref | The head ref to checkout. If not provided, the head default branch is used. | N/A | false |
| identity | Atmos auth identity | false | |
| install-atmos | Whether to install atmos | true | false |
| install-jq | Whether to install jq | false | false |
| install-spacectl | Whether to install spacectl | true | false |
| jq-force | Whether to force the installation of jq | true | false |
| jq-version | The version of jq to install if install-jq is true | 1.7 | false |
| nested-matrices-count | Number of nested matrices that should be returned as the output (from 1 to 3) | 2 | false |
| skip-atmos-functions | Skip all Atmos functions such as terraform.output in atmos describe affected | false | false |
| skip-checkout | Disable actions/checkout for head-ref and base-ref. Useful for when the checkout happens in a previous step and file are modified outside of git through other actions | false | false |
| skip-process-functions | Skip processing Atmos functions in atmos describe affected | false | false |
| skip-process-templates | Skip processing Atmos templates in atmos describe affected | false | false |
| spacectl-version | The version of spacectl to install if install-spacectl is true | latest | false |
| spacelift-api-key-id | The SPACELIFT_API_KEY_ID | N/A | false |
| spacelift-api-key-secret | The SPACELIFT_API_KEY_SECRET | N/A | false |
| spacelift-endpoint | The Spacelift endpoint. For example, https://unicorn.app.spacelift.io | N/A | false |
| trigger-method | The method to use to trigger the Spacelift stack. Valid values are comment and spacectl | comment | false |
Outputs
| Name | Description |
|---|---|
| affected | The affected stacks |
| has-affected-stacks | Whether there are affected stacks |
| matrix | The affected stacks as matrix structure suitable for extending matrix size workaround |