Skip to content

Commit

Permalink
Fix download actions (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger authored Jun 16, 2024
1 parent d8dc4f0 commit e6a1e5c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,19 @@ jobs:
"install-awslocal": "true",
"configuration": "DEBUG=1",
"use-pro": "true",
"state-name": "cloud-pods-test",
"state-action": "load",
"state-backend": "local",
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

- name: Run AWS Commands
run: |
awslocal s3 rb s3://test
awslocal s3 mb s3://test
awslocal sqs delete-queue --queue-url $(awslocal sqs get-queue-url --queue-name test-queue --output text)
awslocal sqs create-queue --queue-name test-queue
- name: Save the State Artifact
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ inputs:
skip-ephemeral-stop:
description: 'Skip stopping LocalStack Ephemeral Instance'
required: false
default: 'false'
default: 'true'
state-action:
description: |
Manage LocalStack state
Expand Down Expand Up @@ -149,11 +149,11 @@ runs:
}
- name: Stop Ephemeral Instance
if: ${{ !inputs.skip-ephemeral-stop && inputs.state-action == 'stop' && inputs.state-backend == 'ephemeral' }}
if: ${{ (inputs.skip-ephemeral-stop == 'false' || inputs.state-action == 'stop') && inputs.state-backend == 'ephemeral' }}
uses: jenseng/dynamic-uses@v1
with:
uses: ${{ env.GH_ACTION_ROOT }}/ephemeral/shutdown
with: |-
{
"name": ${{ toJSON(inputs.github-token) }},
"github-token": ${{ toJSON(inputs.github-token) }},
}
18 changes: 15 additions & 3 deletions finish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@ inputs:
runs:
using: composite
steps:
- name: Download PR artifact
uses: dawidd6/action-download-artifact@v2
# Try to get pr artifact from current workflow
- name: Download current PR artifact
id: get-pr-artifact
uses: actions/download-artifact@v3
continue-on-error: true
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr

# If the above fails, try to get the latest pr artifact from the PR related workflows
- name: Download latest PR artifact
uses: dawidd6/action-download-artifact@v6
if: ${{ steps.get-pr-artifact.outcome == 'failure' }}
with:
name: pr
pr: ${{ github.event.pull_request.number }}
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}

- name: Load the PR ID
id: pr
shell: bash
Expand Down
19 changes: 14 additions & 5 deletions local/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ inputs:
runs:
using: "composite"
steps:
- name: Download PR artifact
uses: dawidd6/action-download-artifact@v2
# Try to get pr artifact from current workflow
- name: Download current workflow's Local State artifact
id: get-state-artifact
if: ${{ inputs.action == 'load' }}
env:
workflow_id: ${{ env.WORKFLOW_ID == '' && github.event.workflow_run.workflow_id || env.WORKFLOW_ID }}
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: ${{ inputs.name }}

# If the above fails, try to get the latest artifact from given workflow
- name: Download latest Local State artifact
uses: dawidd6/action-download-artifact@v6
if: ${{ inputs.action == 'load' && steps.get-state-artifact.outcome == 'failure' }}
with:
workflow:
name: ${{ inputs.name }}
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
if_no_artifact_found: warn

- run: |
if [ "$ACTION" = "save" ]; then
Expand Down

0 comments on commit e6a1e5c

Please sign in to comment.