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

Fixing a typo, and adding a few suggested checks #18

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
2 changes: 1 addition & 1 deletion zenodo_new_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ "$2" == "--verbose" ] || [ "$2" == "-v" ]; then
VERBOSE=1
fi

ZENODO_ENDPOINT=${ZENODO_ENDPOINT-:https://zenodo.org}
ZENODO_ENDPOINT=${ZENODO_ENDPOINT:-https://zenodo.org}

DEPOSITION_ENDPOINT="${ZENODO_ENDPOINT}/api/deposit/depositions/${DEPOSIT}/actions/newversion"

Expand Down
22 changes: 22 additions & 0 deletions zenodo_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,28 @@ if [ "$3" == "--verbose" ] || [ "$3" == "-v" ]; then
VERBOSE=1
fi

# Test if ZENODO_TOKEN is defined

if [ -z "$ZENODO_TOKEN " ]; then
echo "Please use the ZENODO_TOKEN environment variable to set your Zenodo API token."
echo "You can create a new token at https://zenodo.org/account/settings/applications/tokens/new/"
exit 2
fi

# test if jq is installed

if ! command -v jq &> /dev/null; then
echo "jq could not be found. Please install jq to run this script."
exit 2
fi

# Test if the file provided is actually a file

if [ ! -f "$2" ]; then
echo "The file $2 does not exist."
exit 2
fi

# strip deposition url prefix if provided; see https://github.com/jhpoelen/zenodo-upload/issues/2#issuecomment-797657717
DEPOSITION=$( echo $1 | sed 's+^http[s]*://zenodo.org/deposit/++g' )
FILEPATH="$2"
Expand Down