Skip to content

Commit 80d4bf5

Browse files
authored
fix: multiline inputs issue (#26)
1 parent 8d133b9 commit 80d4bf5

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

.github/workflows/ephemeral.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@ jobs:
1515
uses: LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
1616
with: |-
1717
{
18-
"github-token": "${{ secrets.GITHUB_TOKEN }}",
18+
"github-token": ${{ toJSON(secrets.GITHUB_TOKEN) }},
1919
"state-backend": "ephemeral",
2020
"state-action": "start",
21-
"skip-ephemeral-stop": "true"
21+
"skip-ephemeral-stop": "true",
22+
"preview-cmd": ${{ toJSON(env.PREVIEW_CMD) }}
2223
}
2324
env:
2425
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
2526
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
27+
PREVIEW_CMD: |-
28+
awslocal s3 mb s3://test-bucket
29+
awslocal sqs create-queue --queue-name=test-queue
30+
echo "Deploy is done."
2631
2732
# We want explicit shutdown
2833
- name: Shutdown ephemeral instance
@@ -31,7 +36,7 @@ jobs:
3136
uses: LocalStack/setup-localstack@${{ env.GH_ACTION_VERSION }}
3237
with: |-
3338
{
34-
"github-token": "${{ secrets.GITHUB_TOKEN }}",
39+
"github-token": ${{ toJSON(secrets.GITHUB_TOKEN) }},
3540
"state-backend": "ephemeral",
3641
"state-action": "stop"
3742
}

action.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ runs:
9191
uses: ${{ env.GH_ACTION_ROOT }}/tools
9292
with: |-
9393
{
94-
"install-awslocal": "${{ inputs.install-awslocal }}",
94+
"install-awslocal": ${{ toJSON(inputs.install-awslocal) }},
9595
}
9696
9797
- name: Start Localstack
@@ -104,12 +104,12 @@ runs:
104104
# keeping in there install-awslocal for backward compatibility
105105
with: |-
106106
{
107-
"image-tag": "${{ inputs.image-tag }}",
108-
"install-awslocal": "${{ inputs.install-awslocal }}",
109-
"use-pro": "${{ inputs.use-pro }}",
110-
"configuration": "${{ inputs.configuration }}",
111-
"ci-project": "${{ inputs.ci-project }}",
112-
"skip-wait": "${{ inputs.skip-wait }}"
107+
"image-tag": ${{ toJSON(inputs.image-tag) }},
108+
"install-awslocal": ${{ toJSON(inputs.install-awslocal) }},
109+
"use-pro": ${{ toJSON(inputs.use-pro) }},
110+
"configuration": ${{ toJSON(inputs.configuration) }},
111+
"ci-project": ${{ toJSON(inputs.ci-project) }},
112+
"skip-wait": ${{ toJSON(inputs.skip-wait) }}
113113
}
114114
115115
- name: Create Ephemeral Instance
@@ -119,9 +119,9 @@ runs:
119119
uses: ${{ env.GH_ACTION_ROOT }}/ephemeral/startup
120120
with: |-
121121
{
122-
"github-token": "${{ inputs.github-token }}",
123-
"preview-cmd": "${{ inputs.preview-cmd }}",
124-
"auto-load-pod": "${{ inputs.state-name }}"
122+
"github-token": ${{ toJSON(inputs.github-token) }},
123+
"preview-cmd": ${{ toJSON(inputs.preview-cmd) }},
124+
"auto-load-pod": ${{ toJSON(inputs.state-name) }}
125125
}
126126
127127
# Use different artifact from current workflow's by passing the workflow's id as WORKFLOW_ID env variable
@@ -132,8 +132,8 @@ runs:
132132
uses: ${{ env.GH_ACTION_ROOT }}/${{ inputs.state-backend }}
133133
with: |-
134134
{
135-
"name": "${{ inputs.state-name }}",
136-
"action": "${{ inputs.state-action }}"
135+
"name": ${{ toJSON(inputs.state-name) }},
136+
"action": ${{ toJSON(inputs.state-action) }}
137137
}
138138
139139
- name: Display Ephemeral Instance URL
@@ -145,9 +145,9 @@ runs:
145145
uses: ${{ env.GH_ACTION_ROOT }}/finish
146146
with: |-
147147
{
148-
"github-token": "${{ inputs.github-token }}",
149-
"ci-project": "${{ inputs.ci-project }}",
150-
"include-preview": "${{ inputs.include-preview != '' && inputs.include-preview || env.include-preview }}"
148+
"github-token": ${{ toJSON(inputs.github-token) }},
149+
"ci-project": ${{ toJSON(inputs.ci-project) }},
150+
"include-preview": ${{ inputs.include-preview != '' && toJSON(inputs.include-preview) || toJSON(env.include-preview) }}
151151
}
152152
153153
- name: Stop Ephemeral Instance
@@ -157,5 +157,5 @@ runs:
157157
uses: ${{ env.GH_ACTION_ROOT }}/ephemeral/shutdown
158158
with: |-
159159
{
160-
"name": "${{ inputs.github-token }}",
160+
"name": ${{ toJSON(inputs.github-token) }},
161161
}

ephemeral/startup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ runs:
3838
uses: ${{ env.GH_ACTION_ROOT }}/prepare
3939
with: |-
4040
{
41-
"github-token": "${{ inputs.github-token }}"
41+
"github-token": ${{ toJSON(inputs.github-token) }}
4242
}
4343
4444
- name: Download PR artifact

startup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ runs:
5555
uses: ${{ env.GH_ACTION_ROOT }}/tools
5656
with: |-
5757
{
58-
"install-awslocal": "${{ inputs.install-awslocal }}",
58+
"install-awslocal": ${{ toJSON(inputs.install-awslocal) }},
5959
}
6060
6161
- name: Start LocalStack

0 commit comments

Comments
 (0)