Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing all echos with printf #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ set -o pipefail
# We derive variables from the environment instead of command line

# Tell the user files found immediately
echo "Found files in workspace:"
printf "Found files in workspace:\n"
ls

# Project file and if are both required for generation!
# The action requires, but we have the double check here for a fallback
if [ -z "${INPUT_PROJECT_FILE}" ]; then
echo "Project file (project-file) is required"
printf "Project file (project-file) is required\n"
exit 1
fi

# Show the user where we are
echo "Present working directory is:"
printf "Present working directory is:\n"
pwd
ls

Expand Down Expand Up @@ -51,7 +51,7 @@ node /code/bin/sourcecred.js scores "${INPUT_PROJECT}" | python3 -m json.tool >

# Automated means that we push to a branch, otherwise we open a pull request
if [ "${INPUT_AUTOMATED}" == "true" ]; then
echo "Automated PR requested"
printf "Automated PR requested\n"
UPDATE_BRANCH="${INPUT_BRANCH_AGAINST}"
else
UPDATE_BRANCH="update/sourcecred-cred-$(date '+%Y-%m-%d')"
Expand All @@ -74,7 +74,7 @@ git checkout -b "${UPDATE_BRANCH}"
git branch

if [ "${INPUT_AUTOMATED}" == "true" ]; then
git pull origin "${UPDATE_BRANCH}" || echo "Branch not yet on remote"
git pull origin "${UPDATE_BRANCH}" || printf "Branch not yet on remote\n"
git add "${INPUT_TARGET}/*"
git add "${INPUT_SCORES_JSON}"
git commit -m "Automated deployment to update cred in ${INPUT_TARGET} $(date '+%Y-%m-%d')"
Expand Down
16 changes: 8 additions & 8 deletions scripts/pull_request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PULLS_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls"
check_credentials() {

if [[ -z "${GITHUB_TOKEN}" ]]; then
echo "You must include the GITHUB_TOKEN as an environment variable."
printf "You must include the GITHUB_TOKEN as an environment variable.\n"
exit 1
fi

Expand Down Expand Up @@ -60,7 +60,7 @@ print(data[0]["head"]["ref"])')

# Option 1: The pull request is already open
if [[ "${PR}" == "${SOURCE}" ]]; then
printf '%s\n' "Pull request from ${SOURCE} to ${TARGET} is already open!"
printf '%s\n' "Pull request from ${SOURCE} to ${TARGET} is already open\n"

# Option 2: Open a new pull request
else
Expand All @@ -70,7 +70,7 @@ print(data[0]["head"]["ref"])')
set -x;
curl -fsSL -K "${curl_config}" -X POST --data "${DATA}" "${PULLS_URL}"
)
echo $?
printf "$?\n"
fi
}

Expand All @@ -85,7 +85,7 @@ main() {

# User specified branch for PR
if [ -z "${UPDATE_BRANCH}" ]; then
echo "You must specify a branch to PR from."
printf "You must specify a branch to PR from.\n"
exit 1
fi
printf '%s\n' "Branch for pull request is ${UPDATE_BRANCH}"
Expand All @@ -101,8 +101,8 @@ main() {

}

echo "==========================================================================
START: Creating SourceCred Cred Update Pull Request!";
printf "==========================================================================
START: Creating SourceCred Cred Update Pull Request\n";
main "$@"
echo "==========================================================================
END: Finished";
printf "==========================================================================
END: Finished\n";