Skip to content

Commit

Permalink
refactor(ci): refactor ternary logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger committed May 29, 2024
1 parent 2a0c82f commit 5b47bda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' ? github.ref_name : github.head_ref }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

- name: Run Tests against LocalStack
run: |
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

- name: Run AWS commands
run: |
Expand All @@ -81,7 +81,7 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

local-state-test:
name: 'Test Local State Action'
Expand All @@ -103,7 +103,7 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

- name: Run AWS commands
run: |
Expand All @@ -123,4 +123,4 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
4 changes: 2 additions & 2 deletions .github/workflows/ephemeral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}

# We want explicit shutdown
- name: Shutdown ephemeral instance
Expand All @@ -37,4 +37,4 @@ jobs:
}
env:
LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
GH_ACTION_VERSION: ${{ fromJSON(format('["{0}","{1}"]', github.ref_name, github.head_ref))[github.event_name == 'pull_request'] }}
GH_ACTION_VERSION: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
2 changes: 1 addition & 1 deletion local/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
uses: dawidd6/action-download-artifact@v2
if: ${{ inputs.action == 'load' }}
env:
workflow_id: ${{ fromJSON(format('["{0}","{1}"]', env.WORKFLOW_ID, github.event.workflow_run.workflow_id))[env.WORKFLOW_ID == ''] }}
workflow_id: ${{ env.WORKFLOW_ID == '' && github.event.workflow_run.workflow_id || env.WORKFLOW_ID }}
with:
workflow:
name: ${{ inputs.name }}
Expand Down

0 comments on commit 5b47bda

Please sign in to comment.