Skip to content

Commit

Permalink
fix: error checking stack status when / is included in the stack name (
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 authored Mar 7, 2024
1 parent 7e86375 commit 1409497
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ jobs:
name: Test aws-cdk
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.17.5'

- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
go-version-file: 'test/go.mod'
cache-dependency-path: 'test/go.sum'

- name: Install dependencies
run: go install
Expand Down
15 changes: 11 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,25 @@ runs:
working-directory: ${{ inputs.working_dir }}
if: inputs.cdk_stack != '*'
run: |
stack_status=$(aws cloudformation describe-stacks --stack-name "${{ inputs.cdk_stack }}" --query 'Stacks[0].StackStatus' --output text) 2>/dev/null || true
# Original stack name
CDK_STACK="${{ inputs.cdk_stack }}"
# Replace '/' with '-' in the stack name
MODIFIED_STACK_NAME="${CDK_STACK//\//-}"
stack_status=$(aws cloudformation describe-stacks --stack-name "$MODIFIED_STACK_NAME" --query 'Stacks[0].StackStatus' --output text) 2>/dev/null || true
echo "Stack status: $stack_status"
echo "stack_status=$stack_status" >> $GITHUB_OUTPUT
echo "stack_name=$MODIFIED_STACK_NAME" >> $GITHUB_OUTPUT
shell: bash

- name: Wait for stack update-complete
working-directory: ${{ inputs.working_dir }}
if: steps.check.outputs.stack_status == 'UPDATE_IN_PROGRESS'
run: |
echo "Waiting for "${{ inputs.cdk_stack }}" to complete updating..."
aws cloudformation wait stack-update-complete --stack-name "${{ inputs.cdk_stack }}" 2>/dev/null || true
echo "${{ inputs.cdk_stack }} updated"
echo "Waiting for "${{ steps.check.outputs.stack_name }}" to complete updating..."
aws cloudformation wait stack-update-complete --stack-name "${{ steps.check.outputs.stack_name }}" 2>/dev/null || true
echo "${{ steps.check.outputs.stack_name }} update complete"
shell: bash

- name: Run aws-cdk
Expand Down

0 comments on commit 1409497

Please sign in to comment.