initial commit
This commit is contained in:
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_NAME="${1:-}"
|
||||
|
||||
if [[ -z "${SCRIPT_NAME}" ]]; then
|
||||
echo "Usage: $0 <script-subdirectory>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RUNNER="${HOOK_DIR}/${SCRIPT_NAME}/run.sh"
|
||||
|
||||
if [[ ! -f "${RUNNER}" ]]; then
|
||||
echo "Hook script not found: ${RUNNER}" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ ! -x "${RUNNER}" ]]; then
|
||||
echo "Hook script is not executable: ${RUNNER}" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exec "${RUNNER}"
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(git rev-parse --show-toplevel)"
|
||||
cd "${repo_root}"
|
||||
|
||||
output_dir="${repo_root}/.argocd"
|
||||
output_file="${output_dir}/repo"
|
||||
workflow_dir="${repo_root}/.gitea/workflows"
|
||||
|
||||
mkdir -p "${output_dir}"
|
||||
|
||||
origin_url="$(git remote get-url origin 2>/dev/null || true)"
|
||||
branch="$(git symbolic-ref --quiet --short HEAD 2>/dev/null || git rev-parse --short HEAD)"
|
||||
|
||||
{
|
||||
printf 'remote_origin_url=%s\n' "${origin_url}"
|
||||
printf 'branch=%s\n' "${branch}"
|
||||
|
||||
if [[ -d "${workflow_dir}" ]]; then
|
||||
find "${workflow_dir}" -maxdepth 1 -type f -printf '%f\n' \
|
||||
| sort \
|
||||
| while IFS= read -r workflow_file; do
|
||||
printf 'workflow=%s\n' "${workflow_file}"
|
||||
done
|
||||
fi
|
||||
} > "${output_file}"
|
||||
|
||||
git add "${output_file}"
|
||||
Reference in New Issue
Block a user