diff --git a/cd.sh b/cd.sh index eddae10..1884737 100644 --- a/cd.sh +++ b/cd.sh @@ -350,16 +350,40 @@ Acquire::https::Verify-Peer False; # continuous integration platform if [ -n "${GITHUB_ACTIONS}" ] ; then # github → gitea → forgejo - CD_SERVER_URL="${GITHUB_SERVER_URL}" - CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")" - CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" - CD_PROJECT_BRANCH="${GITHUB_REF_NAME}" + if [ -n "${GITHUB_SERVER_URL}" ] ; then + CD_SERVER_URL="${GITHUB_SERVER_URL}" + else + cd_error_ci "GITHUB_SERVER_URL" + fi + if [ -n "${GITHUB_REPOSITORY}" ] ; then + CD_PROJECTS_GROUP="$(dirname "${GITHUB_REPOSITORY}")" + CD_PROJECT_NAME="$(basename "${GITHUB_REPOSITORY}")" + else + cd_error_ci "GITHUB_REPOSITORY" + fi + if [ -n "${GITHUB_REF_NAME}" ] ; then + CD_PROJECT_BRANCH="${GITHUB_REF_NAME}" + else + cd_error_ci "GITHUB_REF_NAME" + fi elif [ -n "${GITLAB_CI}" ] ; then # gitlab - CD_SERVER_URL="${CI_SERVER_URL}" - CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")" - CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")" - CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" + if [ -n "${CI_SERVER_URL}" ] ; then + CD_SERVER_URL="${CI_SERVER_URL}" + else + cd_error_ci "CI_SERVER_URL" + fi + if [ -n "${CI_PROJECT_PATH}" ] ; then + CD_PROJECTS_GROUP="$(dirname "${CI_PROJECT_PATH}")" + CD_PROJECT_NAME="$(basename "${CI_PROJECT_PATH}")" + else + cd_error_ci "CI_PROJECT_PATH" + fi + if [ -n "${CI_COMMIT_BRANCH}" ] ; then + CD_PROJECT_BRANCH="${CI_COMMIT_BRANCH}" + else + cd_error_ci "CI_COMMIT_BRANCH" + fi else # unsupported cd_error_ci "ø"