Skip to content

Commit e6a1e5c

Browse files
authored
Fix download actions (#30)
1 parent d8dc4f0 commit e6a1e5c

File tree

4 files changed

+37
-11
lines changed

4 files changed

+37
-11
lines changed

.github/workflows/ci.yml

+5
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,19 @@ jobs:
127127
"install-awslocal": "true",
128128
"configuration": "DEBUG=1",
129129
"use-pro": "true",
130+
"state-name": "cloud-pods-test",
131+
"state-action": "load",
132+
"state-backend": "local",
130133
}
131134
env:
132135
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
133136
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
134137

135138
- name: Run AWS Commands
136139
run: |
140+
awslocal s3 rb s3://test
137141
awslocal s3 mb s3://test
142+
awslocal sqs delete-queue --queue-url $(awslocal sqs get-queue-url --queue-name test-queue --output text)
138143
awslocal sqs create-queue --queue-name test-queue
139144
140145
- name: Save the State Artifact

action.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ inputs:
5050
skip-ephemeral-stop:
5151
description: 'Skip stopping LocalStack Ephemeral Instance'
5252
required: false
53-
default: 'false'
53+
default: 'true'
5454
state-action:
5555
description: |
5656
Manage LocalStack state
@@ -149,11 +149,11 @@ runs:
149149
}
150150
151151
- name: Stop Ephemeral Instance
152-
if: ${{ !inputs.skip-ephemeral-stop && inputs.state-action == 'stop' && inputs.state-backend == 'ephemeral' }}
152+
if: ${{ (inputs.skip-ephemeral-stop == 'false' || inputs.state-action == 'stop') && inputs.state-backend == 'ephemeral' }}
153153
uses: jenseng/dynamic-uses@v1
154154
with:
155155
uses: ${{ env.GH_ACTION_ROOT }}/ephemeral/shutdown
156156
with: |-
157157
{
158-
"name": ${{ toJSON(inputs.github-token) }},
158+
"github-token": ${{ toJSON(inputs.github-token) }},
159159
}

finish/action.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,24 @@ inputs:
1717
runs:
1818
using: composite
1919
steps:
20-
- name: Download PR artifact
21-
uses: dawidd6/action-download-artifact@v2
20+
# Try to get pr artifact from current workflow
21+
- name: Download current PR artifact
22+
id: get-pr-artifact
23+
uses: actions/download-artifact@v3
24+
continue-on-error: true
2225
with:
23-
workflow: ${{ github.event.workflow_run.workflow_id }}
2426
name: pr
2527

28+
# If the above fails, try to get the latest pr artifact from the PR related workflows
29+
- name: Download latest PR artifact
30+
uses: dawidd6/action-download-artifact@v6
31+
if: ${{ steps.get-pr-artifact.outcome == 'failure' }}
32+
with:
33+
name: pr
34+
pr: ${{ github.event.pull_request.number }}
35+
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
36+
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}
37+
2638
- name: Load the PR ID
2739
id: pr
2840
shell: bash

local/action.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,23 @@ inputs:
1313
runs:
1414
using: "composite"
1515
steps:
16-
- name: Download PR artifact
17-
uses: dawidd6/action-download-artifact@v2
16+
# Try to get pr artifact from current workflow
17+
- name: Download current workflow's Local State artifact
18+
id: get-state-artifact
1819
if: ${{ inputs.action == 'load' }}
19-
env:
20-
workflow_id: ${{ env.WORKFLOW_ID == '' && github.event.workflow_run.workflow_id || env.WORKFLOW_ID }}
20+
uses: actions/download-artifact@v3
21+
continue-on-error: true
22+
with:
23+
name: ${{ inputs.name }}
24+
25+
# If the above fails, try to get the latest artifact from given workflow
26+
- name: Download latest Local State artifact
27+
uses: dawidd6/action-download-artifact@v6
28+
if: ${{ inputs.action == 'load' && steps.get-state-artifact.outcome == 'failure' }}
2129
with:
22-
workflow:
2330
name: ${{ inputs.name }}
31+
workflow: ${{ env.LS_STATE_ARTIFACT_WORKFLOW }} # Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
32+
if_no_artifact_found: warn
2433

2534
- run: |
2635
if [ "$ACTION" = "save" ]; then

0 commit comments

Comments
 (0)