From 0f4fa8f573c5b8333b6f1c3ffd61dda35b2affae Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 28 Jul 2022 21:48:04 -0700 Subject: test(ci): create a dummy ~/.python-gitlab.cfg file Create a working ~/.python-gitlab.cfg file when running the unit tests in the CI. This is to ensure our unit tests still work if a config file exists. --- tests/ci_tools/setup-dummy-config.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tests/ci_tools/setup-dummy-config.sh (limited to 'tests') diff --git a/tests/ci_tools/setup-dummy-config.sh b/tests/ci_tools/setup-dummy-config.sh new file mode 100755 index 0000000..4a31618 --- /dev/null +++ b/tests/ci_tools/setup-dummy-config.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -u + +if [[ -z "${CI:-}" || -z "${GITHUB_ACTIONS:-}" ]]; then + echo "ERROR: Not running in the GitHub CI." + exit 2 +fi + +CONFIG_FILE=~/.python-gitlab.cfg +if [[ -e "${CONFIG_FILE}" ]]; then + echo "ERROR: Config file already exists: ${CONFIG_FILE}" + echo "Saved you from destroying your config" + exit 2 +fi + +cat <"${CONFIG_FILE}" +[global] +default = gitlab +ssl_verify = true +timeout = 5 +api_version = 4 + +[gitlab] +url = https://gitlab.com/ +private_token = not-a-valid-token +EOF + +echo "Setup config at: ${CONFIG_FILE}" -- cgit v1.2.1