Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error checking stack status when / is included in the stack name #94

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading