From 157a59bbbbd77eaf807ec448ef96112b1c1719f2 Mon Sep 17 00:00:00 2001 From: Caleb Woodbine Date: Wed, 11 Oct 2023 11:24:56 +1300 Subject: [PATCH] chore: add script to write branchprotector checks from the format of ./hack/list-checks.sh --- hack/set-bp-yaml-checks.sh | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 hack/set-bp-yaml-checks.sh diff --git a/hack/set-bp-yaml-checks.sh b/hack/set-bp-yaml-checks.sh new file mode 100755 index 0000000..e26748b --- /dev/null +++ b/hack/set-bp-yaml-checks.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +# NOTE must be in format from ./hack/list-checks.sh +INPUT="$(< /dev/stdin yq e)" +# NOTE only manages the fields +# .branch-protection.orgs.ORG.repos.REPO.branches.DEFAULT +# - .protect +# - .required_status_checks.contexts +OUTPUT="${1:-}" + +if [ -z "$OUTPUT" ]; then + cat <