This repository has been archived on 2022-08-30. You can view files and clone it, but cannot push or open issues or pull requests.
renovate-bot/entrypoint.sh
decentral1se e35cd60222
Some checks failed
continuous-integration/drone/push Build is failing
Support GITHUB_COM_TOKEN
2021-06-03 11:00:08 +02:00

30 lines
479 B
Bash

#!/bin/bash
set -e
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
file_env "GITHUB_COM_TOKEN"
exec "$@"