Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rindrics committed Jun 15, 2024
1 parent 515ceb4 commit 5849fd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ inputs:
runs:
using: 'composite'
steps:
- name: Get current workflow file
id: get-workflow
run: echo "workflow_file=${{ github.event.workflow }}" >> $GITHUB_ENV

- name: Check parameters
shell: bash
run: ./scripts/validate-param.sh
env:
PARAMS: ${{ inputs.params }}
WORKFLOW_FILE: ${{ github.workspace }}/.github/workflows/${{ env.workflow_file }}.yml
7 changes: 4 additions & 3 deletions scripts/validate-param.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

# Extract inputs
PARAMS=$PARAMS
WORKFLOW_FILE=$WORKFLOW_FILE

# Check if the workflow file exists
if [ ! -f "${GITHUB_WORKFLOW}" ]; then
echo "Workflow file not found: ${GITHUB_WORKFLOW}"
if [ ! -f "${WORKFLOW_FILE}" ]; then
echo "Workflow file not found: ${WORKFLOW_FILE}"
exit 1
fi

Expand All @@ -19,7 +20,7 @@ echo "${PARAMS}" | jq -c 'to_entries | .[]' | while read -r step; do
EXPECTED_VALUE=$(echo "${param}" | jq -r '.value')

# Check the parameter in the workflow file
grep -A 5 "id: ${STEP_ID}" "${GITHUB_WORKFLOW}" | grep "${PARAM}: ${EXPECTED_VALUE}"
grep -A 5 "id: ${STEP_ID}" "${WORKFLOW_FILE}" | grep "${PARAM}: ${EXPECTED_VALUE}"

if [ $? -ne 0 ]; then
echo "The parameter ${PARAM} for step ${STEP_ID} is not set to ${EXPECTED_VALUE}."
Expand Down

0 comments on commit 5849fd5

Please sign in to comment.