Action fails when there are no SAM changes

Open
#10 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
aws, github-actions
Domain
ci-cd, cloud, devops

Research direction

Start with template.yml and the “SAM Validate, Build, Test, Deploy” workflow, focusing on the failing “SAM deploy” step. Reproduce the failure by rerunning a completed workflow without SAM template changes, then verify that the job succeeds and reports no deployment changes when there is nothing to deploy.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
When a change is pushed to main which doesn't update the SAM template, the deployment job will fail.

To Reproduce
Steps to reproduce the behavior:
The previous workflow must have completed successfully, and the repo hasn't been updated.

  1. Go to Actions
  2. Click on workflow "SAM Validate, Build, Test, Deploy"
  3. Choose "Re-run jobs"

This job will fail

Expected behavior
The running job should succeed

Screenshots
Step "SAM deploy" fails with the following error:
image
(note that I ran this from my own fork, so the stack name is different to what you will expect)

A possible fix: Change the last command in template.yml to the following:

      sam deploy --template-file .aws-sam/build/template.yaml \
        --stack-name ${{ steps.vars.outputs.environment }} \
        --s3-bucket ${{ steps.vars.outputs.environment }} \
        --parameter-overrides \
          'ParameterKey=Name,ParameterValue=example \
          ParameterKey=Version,ParameterValue=${{ steps.vars.outputs.version }}' \
        --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
        || echo "Nothing to deploy, no changes"
Dominant language
Python
Stars
63
Forks
40
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.