DEV Community

Discussion on: Preview environments per Pull Request using AWS CDK and Github Actions

Collapse
 
naseem profile image
naseem

Such a great walkthrough! Thanks so much.

May I suggest the following enhancements:

  1. underscores in the gh head ref name can cause issues when AWS tries creating a stack with that name, as such pipe STAGE to tr '_' '-' to replace any underscores with dashes

  2. consecutive deploys that happen too soon will result in the deploy workflow failing cause a CREATE or UPDATE is already in progress, use github workflow's concurrency feature as follows, to prevent concurrent deploy workflows from running:

jobs:
  deploy:
    concurrency: deploy-pr-app-${{ github.head_ref }}
Enter fullscreen mode Exit fullscreen mode