From bcf6037e197b4a6fa533c8fb7af906682e7df4e7 Mon Sep 17 00:00:00 2001 From: Janik <10290002+led0nk@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:36:03 +0200 Subject: [PATCH] echo -n fix --- .github/workflows/scripts/add-codeowners-to-pr.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/scripts/add-codeowners-to-pr.sh b/.github/workflows/scripts/add-codeowners-to-pr.sh index 2a43d74fc659..b0b138c5d9a8 100755 --- a/.github/workflows/scripts/add-codeowners-to-pr.sh +++ b/.github/workflows/scripts/add-codeowners-to-pr.sh @@ -29,9 +29,9 @@ main () { # is only available through the API. To cut down on API calls to GitHub, # we use the latest reviews to determine which users to filter out. JSON=$(gh pr view "${PR}" --json "files,author,latestReviews" | tr -dc '[:print:]' | sed -E 's/\\[a-z]//g') - AUTHOR=$(echo "${JSON}"| jq -r '.author.login') - FILES=$(echo "${JSON}"| jq -r '.files[].path') - REVIEW_LOGINS=$(echo "${JSON}"| jq -r '.latestReviews[].author.login') + AUTHOR=$(echo -n "${JSON}"| jq -r '.author.login') + FILES=$(echo -n "${JSON}"| jq -r '.files[].path') + REVIEW_LOGINS=$(echo -n "${JSON}"| jq -r '.latestReviews[].author.login') COMPONENTS=$(bash "${CUR_DIRECTORY}/get-components.sh") REVIEWERS="" LABELS="" @@ -59,14 +59,14 @@ main () { # won't be checked against the remaining components in the components # list. This provides a meaningful speedup in practice. for FILE in ${FILES}; do - MATCH=$(echo "${FILE}" | grep -E "^${COMPONENT}" || true) + MATCH=$(echo -n "${FILE}" | grep -E "^${COMPONENT}" || true) if [[ -z "${MATCH}" ]]; then continue fi # If we match a file with a component we don't need to process the file again. - FILES=$(echo "${FILES}" | grep -v "${FILE}") + FILES=$(echo -n "${FILES}" | grep -v "${FILE}") if [[ -v PROCESSED_COMPONENTS["${COMPONENT}"] ]]; then continue @@ -87,11 +87,11 @@ main () { if [[ -n "${REVIEWERS}" ]]; then REVIEWERS+="," fi - REVIEWERS+=$(echo "${OWNER}" | sed -E 's/@(.+)/"\1"/') + REVIEWERS+=$(echo -n "${OWNER}" | sed -E 's/@(.+)/"\1"/') done # Convert the CODEOWNERS entry to a label - COMPONENT_NAME=$(echo "${COMPONENT}" | sed -E 's%^(.+)/(.+)\1%\1/\2%') + COMPONENT_NAME=$(echo -n "${COMPONENT}" | sed -E 's%^(.+)/(.+)\1%\1/\2%') if (( "${#COMPONENT_NAME}" > 50 )); then echo "'${COMPONENT_NAME}' exceeds GitHub's 50-character limit on labels, skipping adding label"