Some checks failed
Tests / PR mergeability (push) Successful in 1m37s
Tests / Base branch health (push) Successful in 11s
Tests / Detect test scope (push) Successful in 17s
Tests / lint-tests (push) Failing after 2m16s
Tests / plugin-validate (push) Successful in 1m6s
Tests / test (ubuntu-latest, 24, shard 1/3) (push) Failing after 25s
Tests / test (ubuntu-latest, 24, shard 2/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24, shard 3/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24) (push) Failing after 19s
Tests / test (inert CI) (push) Has been skipped
Tests / QA loop walk (smell ratchet) (push) Failing after 19s
Tests / Coverage gate (merged shards) (push) Has been skipped
Tests / Publish emitted-baseline artifact (push) Has been skipped
Dismiss Unauthorized PR Approvals / dismiss-unauthorized-approval (push) Successful in 9s
Close Draft PRs (sweep) / Sweep open draft PRs (push) Successful in 8s
Tests / conformance test (macos-latest, 24) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 1/3) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 2/3) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 3/3) (push) Has been cancelled
Tests / Required tests (push) Has been cancelled
The fork lives on the golem15 Gitea forge, not GitHub. Package identity now parses either host and derives in-place raw URLs for Gitea; the identity-drift lint accepts the new host; README drops GitHub-only badges and the npm quickstart in favour of the checkout installer.
35 lines
1011 B
Bash
Executable File
35 lines
1011 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REPO="${REPO:-golem15/msd-core}"
|
|
ENFORCEMENT="${ENFORCEMENT:-evaluate}"
|
|
|
|
case "$ENFORCEMENT" in
|
|
disabled|evaluate|active) ;;
|
|
*)
|
|
echo "ERROR: ENFORCEMENT must be one of: disabled|evaluate|active" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
RULESETS_DIR="$SCRIPT_DIR/../.github/rulesets"
|
|
|
|
for ruleset_file in "$RULESETS_DIR"/*.json; do
|
|
name="$(jq -r '.name' "$ruleset_file")"
|
|
|
|
body="$(jq --arg enforcement "$ENFORCEMENT" '.enforcement = $enforcement' "$ruleset_file")"
|
|
|
|
existing_id="$(gh api "repos/$REPO/rulesets" --jq ".[] | select(.name==\"$name\") | .id" 2>/dev/null || true)"
|
|
|
|
if [ -n "$existing_id" ]; then
|
|
gh api --method PUT "repos/$REPO/rulesets/$existing_id" \
|
|
--input - <<< "$body" > /dev/null
|
|
echo "[update] $name -> enforcement=$ENFORCEMENT"
|
|
else
|
|
gh api --method POST "repos/$REPO/rulesets" \
|
|
--input - <<< "$body" > /dev/null
|
|
echo "[create] $name -> enforcement=$ENFORCEMENT"
|
|
fi
|
|
done
|