Skip to main content

GitHub Action: atmos-affected-trigger-spacelift

GitHub Action for Triggering Affected Spacelift Stacks

Introduction

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: github-action-atmos-affected-trigger-spacelift
on:
pull_request:
branches: [ 'main' ]
types: [opened, synchronize, reopened, closed, labeled, unlabeled]

jobs:
context:
runs-on: ubuntu-latest
steps:
- name: github-action-atmos-affected-trigger-spacelift
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: github-action-atmos-affected-trigger-spacelift
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

NameDescriptionDefaultRequired
atmos-config-pathA path to the folder where atmos.yaml is located.false
atmos-versionThe version of atmos to install if install-atmos is truelatestfalse
default-branchThe default branch to use for the base ref.${{ github.event.repository.default_branch }}false
deployA flag to indicate if a deployment should be triggered. If false, a preview will be triggered.falsefalse
github-tokenA GitHub token for running the spacelift-io/setup-spacectl actionN/Atrue
head-refThe head ref to checkout. If not provided, the head default branch is used.N/Afalse
install-atmosWhether to install atmostruefalse
install-jqWhether to install jqfalsefalse
install-spacectlWhether to install spacectltruefalse
install-terraformWhether to install terraformtruefalse
jq-forceWhether to force the installation of jqtruefalse
jq-versionThe version of jq to install if install-jq is true1.6false
spacectl-versionThe version of spacectl to install if install-spacectl is truelatestfalse
spacelift-api-key-idThe SPACELIFT_API_KEY_IDN/Afalse
spacelift-api-key-secretThe SPACELIFT_API_KEY_SECRETN/Afalse
spacelift-endpointThe Spacelift endpoint. For example, https://unicorn.app.spacelift.ioN/Afalse
terraform-versionThe version of terraform to install if install-terraform is truelatestfalse
trigger-methodThe method to use to trigger the Spacelift stack. Valid values are comment and spacectlcommentfalse