Refactor code #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: LocalStack Ephemeral Instance Test | |
on: pull_request | |
jobs: | |
preview-test: | |
permissions: write-all | |
name: 'Test ephemeral instance workflow' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Deploy Preview | |
uses: jenseng/dynamic-uses@v1 | |
with: | |
uses: LocalStack/setup-localstack@${{ env.action-version }} | |
with: |- | |
{ | |
"github-token": "${{ secrets.GITHUB_TOKEN }}", | |
"state-backend": "preview", | |
"state-action": "start", | |
"skip-preview-stop": "true" | |
} | |
env: | |
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} | |
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }} | |
# We want explicit shutdown | |
- name: Shutdown ephemeral instance | |
uses: jenseng/dynamic-uses@v1 | |
with: | |
uses: LocalStack/setup-localstack@${{ env.action-version }} | |
with: |- | |
{ | |
"github-token": "${{ secrets.GITHUB_TOKEN }}", | |
"state-backend": "preview", | |
"state-action": "stop" | |
} | |
env: | |
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }} | |
action-version: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }} |