Skip to content

Commit

Permalink
fix: Fix unquoted shell variables according to ShellCheck (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon authored Jun 9, 2024
1 parent c1d1cf7 commit 187f267
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ runs:
JOBINFO="$(curl --get -Ss -H "Authorization: Bearer ${INPUT_GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "${GITHUB_BASEURL}${GITHUB_API}?per_page=${INPUT_PER_PAGE:-30}")"
echo "${JOBINFO}" | grep "Resource not accessible by integration" && exit 1
TOTAL_COUNT="$(echo "${JOBINFO}" | jq -r .total_count)"
eval "$(echo ${JOBINFO} | jq -r --arg job_name "${INPUT_JOB_NAME}" '.jobs | map(select(.name == $job_name)) | .[0] | @sh "JOB_ID=\(.id) HTML_URL=\(.html_url)"')"
echo ${JOB_ID} | grep "null" > /dev/null && echo "parse error, job_id is ${JOB_ID} and total_count is ${TOTAL_COUNT}. 'job_name' or 'per_page' might be wrong. See https://github.com/Tiryoh/gha-jobid-action/blob/main/README.md#inputs" && exit 1
echo "job_id=${JOB_ID}" >> $GITHUB_OUTPUT
echo "html_url=${HTML_URL}" >> $GITHUB_OUTPUT
eval "$(echo "${JOBINFO}" | jq -r --arg job_name "${INPUT_JOB_NAME}" '.jobs | map(select(.name == $job_name)) | .[0] | @sh "JOB_ID=\(.id) HTML_URL=\(.html_url)"')"
echo "${JOB_ID}" | grep "null" > /dev/null && echo "parse error, job_id is ${JOB_ID} and total_count is ${TOTAL_COUNT}. 'job_name' or 'per_page' might be wrong. See https://github.com/Tiryoh/gha-jobid-action/blob/main/README.md#inputs" && exit 1
echo "job_id=${JOB_ID}" >> "$GITHUB_OUTPUT"
echo "html_url=${HTML_URL}" >> "$GITHUB_OUTPUT"

0 comments on commit 187f267

Please sign in to comment.