mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
Resolve merge conflicts, keep the cleanup script move to scripts/image, and fix the resulting lint regressions.
40 lines
941 B
Bash
Executable File
40 lines
941 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ -n "${OWNER:-}" ]]; then
|
|
printf '%s\n' "${OWNER,,}"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ -n "${GITHUB_REPOSITORY_OWNER:-}" ]]; then
|
|
printf '%s\n' "${GITHUB_REPOSITORY_OWNER,,}"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ -n "${GITHUB_REPOSITORY:-}" ]]; then
|
|
owner="${GITHUB_REPOSITORY%%/*}"
|
|
printf '%s\n' "${owner,,}"
|
|
exit 0
|
|
fi
|
|
|
|
if remote_url="$(git config --get remote.origin.url 2>/dev/null)" && [[ -n "${remote_url}" ]]; then
|
|
remote_path="${remote_url%.git}"
|
|
|
|
if [[ "${remote_path}" == *://* ]]; then
|
|
remote_path="${remote_path#*://}"
|
|
remote_path="${remote_path#*@}"
|
|
remote_path="${remote_path#*/}"
|
|
elif [[ "${remote_path}" == *:* ]]; then
|
|
remote_path="${remote_path#*:}"
|
|
fi
|
|
|
|
if [[ "${remote_path}" == */* ]]; then
|
|
owner="${remote_path%%/*}"
|
|
printf '%s\n' "${owner,,}"
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
echo "ERROR: Could not resolve repository owner from OWNER, GITHUB_REPOSITORY_OWNER, GITHUB_REPOSITORY or git remote." >&2
|
|
exit 1
|