diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54f1f04..6e45678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,9 @@ 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 }} @@ -134,7 +137,9 @@ jobs: - 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 diff --git a/action.yml b/action.yml index cc24c39..b0c4bad 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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) }}, } \ No newline at end of file diff --git a/finish/action.yml b/finish/action.yml index 9a72760..c5e2e09 100644 --- a/finish/action.yml +++ b/finish/action.yml @@ -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 diff --git a/local/action.yml b/local/action.yml index 9f56139..1705300 100644 --- a/local/action.yml +++ b/local/action.yml @@ -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