Skip to content

Commit

Permalink
feat: Require both inputs to be set on action (getsentry#3554)
Browse files Browse the repository at this point in the history
Came as a feature request from @untitaker and I think it makes a lot of sense

---------

Co-authored-by: Hubert Deng <[email protected]>
  • Loading branch information
BYK and hubertdeng123 authored Jan 25, 2025
1 parent 95761f7 commit 9eea781
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ inputs:
runs:
using: "composite"
steps:
- name: Configure to use the test image
if: inputs.project_name && inputs.image_url
- name: Validate inputs and configure test image
shell: bash
env:
PROJECT_NAME: ${{ inputs.project_name }}
IMAGE_URL: ${{ inputs.image_url }}
run: |
image_var=$(echo ${{ inputs.project_name }}_IMAGE | tr '[:lower:]' '[:upper:]')
echo "${image_var}=${{ inputs.image_url }}" >> ${{ github.action_path }}/.env
if [[ -n "$PROJECT_NAME" && -n "$IMAGE_URL" ]]; then
image_var=$(echo "${PROJECT_NAME}_IMAGE" | tr '[:lower:]' '[:upper:]')
echo "${image_var}=$IMAGE_URL" >> ${{ github.action_path }}/.env
elif [[ -z "$PROJECT_NAME" && -z "$IMAGE_URL" ]]; then
echo "No project name and image URL set. Skipping image configuration."
else
echo "You must set both project_name and image_url or unset both."
echo "project_name: $PROJECT_NAME, image_url: $IMAGE_URL"
exit 1
fi
- name: Setup dev environment
shell: bash
Expand Down

0 comments on commit 9eea781

Please sign in to comment.