Issue with github-action-atmos-affected-trigger-spacelift
Not Triggering Affected Stacks
#32
-
ContextWe’ve encountered an issue with the Initial setupOur workflow was configured as follows: name: "Deploy Affected Spacelift Stacks"
on:
pull_request:
types: [closed]
branches:
- main
jobs:
run:
if: github.event.pull_request.merged == true
runs-on:
group: vnext
steps:
- name: Atmos Affected Stacks Trigger Spacelift
uses: cloudposse/github-action-atmos-affected-trigger-spacelift@v2
with:
atmos-config-path: ./rootfs/usr/local/etc/atmos
deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
head-ref: ${{ github.sha }}~1
install-jq: true
jq-version: 1.7
atmos-version: 1.153.0 The error we encountered indicates that the action is not detecting any affected stacks: Summary of Discussionhttps://sweetops.slack.com/archives/C0313BVSVQD/p1738773568526219 Trigger vs. Head Ref:
Impact of Atmos Changes:
Action Versioning:
Long-Term Resolution:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Atmos Version BehaviorIn older Atmos versions the command |
Beta Was this translation helpful? Give feedback.
-
Workaround with
|
Beta Was this translation helpful? Give feedback.
-
Head Ref Issue with Squash CommitsOur configuration uses squash commits. Using |
Beta Was this translation helpful? Give feedback.
-
SolutionThe problem is a conflict between where the workflow is called and what we're setting as What we have above is triggered on Change the trigger to on pushes to Alternatively, we should keep the trigger for on You can also use |
Beta Was this translation helpful? Give feedback.
We had a misunderstanding with the git references and further discussed this in Slack. Following up here for any future reference:
The issue is that by the time the PR has merged, the sha of the main branch (base-ref) has been updated, so we're comparing the wrong diff. Instead, we need to get the previous sha of the main branch, but since the workflow is running on the PR we need to first fetch the history of the base ref.
Here's the solution: