From a11a88ec9842fca17728b2d46c0edc86b4c67268 Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sat, 27 Jun 2026 11:12:44 +0100 Subject: [PATCH 1/5] feat: add ignore-changelog script to suppress markdownlint on CHANGELOG.md --- git/ignore-changelog | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 git/ignore-changelog diff --git a/git/ignore-changelog b/git/ignore-changelog new file mode 100755 index 00000000..cb61882a --- /dev/null +++ b/git/ignore-changelog @@ -0,0 +1,70 @@ +#! /bin/sh + +die() { + printf '\n\033[31m✗\033[0m %s\n' "$*" >&2 + exit 1 +} + +success() { + printf '\n\033[32m✓\033[0m %s\n' "$*" +} + +info() { + printf '\n\033[32m→\033[0m %s\n' "$*" +} + +warn() { + printf '\n\033[33m!\033[0m %s\n' "$*" +} + +IGNORE_FILE=".markdownlintignore" +ENTRY="CHANGELOG.md" +COMMIT_MSG="Add CHANGELOG.md to .markdownlintignore" +DRY_RUN=0 + +for arg in "$@"; do + case "$arg" in + -n|--dry-run) DRY_RUN=1 ;; + *) die "Unknown argument: $arg" ;; + esac +done + +[ "$DRY_RUN" -eq 1 ] && info "Dry run — no files will be written or committed" + +for dir in "$(pwd)"/*/; do + [ -e "${dir}.git" ] || continue + + info "$dir" + + if [ ! -f "${dir}${IGNORE_FILE}" ]; then + if [ "$DRY_RUN" -eq 1 ]; then + info "Would create ${IGNORE_FILE} with ${ENTRY}" + else + printf '%s\n' "$ENTRY" > "${dir}${IGNORE_FILE}" + info "Created ${IGNORE_FILE}" + fi + elif grep -qx "$ENTRY" "${dir}${IGNORE_FILE}"; then + success "Already excludes ${ENTRY} — skipping" + continue + else + if [ "$DRY_RUN" -eq 1 ]; then + info "Would append ${ENTRY} to existing ${IGNORE_FILE}" + else + printf '\n%s\n' "$ENTRY" >> "${dir}${IGNORE_FILE}" + info "Appended ${ENTRY} to ${IGNORE_FILE}" + fi + fi + + if [ "$DRY_RUN" -eq 1 ]; then + info "Would commit and push: ${COMMIT_MSG}" + continue + fi + + git -C "$dir" add "$IGNORE_FILE" || { warn "git add failed in $dir"; continue; } + git -C "$dir" commit -m "$COMMIT_MSG" -n || { warn "git commit failed in $dir"; continue; } + if git -C "$dir" push; then + success "Pushed $dir" + else + warn "git push failed in $dir (committed locally)" + fi +done From 5e5746c7230b7c1e1d373d2d32cbcf815925b918 Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sat, 27 Jun 2026 11:14:12 +0100 Subject: [PATCH 2/5] changelog: add entry for git/ignore-changelog script --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 218bcb65..75a43a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release ## [Unreleased] ### Security ### Added +- git/ignore-changelog: script to add CHANGELOG.md to .markdownlintignore across git repositories - fetch: added --switch-to-main flag to switch to the default branch and rebase it when not on it, skipping if there are uncommitted changes ### Fixed - Shell scripts were cleaned up to pass pre-commit checks, and git/fetch now uses consistent info/success output. From 256d6f8791c9eb3787815e663385e94e89cfe8d9 Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sat, 27 Jun 2026 11:16:53 +0100 Subject: [PATCH 3/5] changelog: use dotnet changelog tool to add ignore-changelog entry Closes #708 Prompt: yes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a43a81..27250be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,8 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release ## [Unreleased] ### Security ### Added -- git/ignore-changelog: script to add CHANGELOG.md to .markdownlintignore across git repositories - fetch: added --switch-to-main flag to switch to the default branch and rebase it when not on it, skipping if there are uncommitted changes +- git/ignore-changelog: script to add CHANGELOG.md to .markdownlintignore across git repositories ### Fixed - Shell scripts were cleaned up to pass pre-commit checks, and git/fetch now uses consistent info/success output. - Replace raw echo output with standard die/success/info helpers in network/wg-create From e31420afe9123f8813366f2d37cd3666565d5f0d Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sat, 27 Jun 2026 11:20:11 +0100 Subject: [PATCH 4/5] feat: add git/reset-all script to hard-reset all repos Closes #709 Prompt: copy clean-all and call it reset-all and get it to do a git reset HEAD --hard instead of the clean and remote pruning --- CHANGELOG.md | 1 + git/reset-all | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 git/reset-all diff --git a/CHANGELOG.md b/CHANGELOG.md index 27250be4..8ed41940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release ### Added - fetch: added --switch-to-main flag to switch to the default branch and rebase it when not on it, skipping if there are uncommitted changes - git/ignore-changelog: script to add CHANGELOG.md to .markdownlintignore across git repositories +- git/reset-all: script to run git reset --hard HEAD across all git repositories ### Fixed - Shell scripts were cleaned up to pass pre-commit checks, and git/fetch now uses consistent info/success output. - Replace raw echo output with standard die/success/info helpers in network/wg-create diff --git a/git/reset-all b/git/reset-all new file mode 100755 index 00000000..a1c83d58 --- /dev/null +++ b/git/reset-all @@ -0,0 +1,24 @@ +#! /bin/sh + +die() { + printf '\n\033[31m✗\033[0m %s\n' "$*" >&2 + exit 1 +} + +success() { + printf '\n\033[32m✓\033[0m %s\n' "$*" +} + +info() { + printf '\n\033[32m→\033[0m %s\n' "$*" +} + +find "$(pwd)"/* -name '*.git' -print | sed "s|/.git$||" | sort -u | grep -v .cache | while IFS= read -r line +do + info "$line" + CURRENT_DIR=$line + + git -C "$CURRENT_DIR" reset --hard HEAD 2>&1 + + success "Done." +done From 982ef8fe1f9aabf218bd64593f01636ce78eefdb Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sat, 27 Jun 2026 11:24:14 +0100 Subject: [PATCH 5/5] feat: add git/push-all and fix push hook bypass in git/ignore-changelog Closes #710 Closes #711 Prompt: commit and push --- CHANGELOG.md | 2 ++ git/ignore-changelog | 2 +- git/push-all | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 git/push-all diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ed41940..090a9991 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release - fetch: added --switch-to-main flag to switch to the default branch and rebase it when not on it, skipping if there are uncommitted changes - git/ignore-changelog: script to add CHANGELOG.md to .markdownlintignore across git repositories - git/reset-all: script to run git reset --hard HEAD across all git repositories +- git/push-all: script to push all git repositories ### Fixed - Shell scripts were cleaned up to pass pre-commit checks, and git/fetch now uses consistent info/success output. - Replace raw echo output with standard die/success/info helpers in network/wg-create @@ -44,6 +45,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release - git/fetch: Unset core.hookspath for each repo during fetch so that globally-configured hook paths do not persist on individual repos - check: use mapfile array for file collection to handle filenames containing spaces correctly - check: guard against empty file list before checking — prevents false-positive success when no scripts are found +- git/ignore-changelog: skip push hooks when pushing to target repositories ### Changed - Replace raw echo with standard output helpers (die/info/success) in github/cancel-workflows - Replace raw echo with standard output helpers (die/info/success) in git/update-repos-personal diff --git a/git/ignore-changelog b/git/ignore-changelog index cb61882a..f1852d6a 100755 --- a/git/ignore-changelog +++ b/git/ignore-changelog @@ -62,7 +62,7 @@ for dir in "$(pwd)"/*/; do git -C "$dir" add "$IGNORE_FILE" || { warn "git add failed in $dir"; continue; } git -C "$dir" commit -m "$COMMIT_MSG" -n || { warn "git commit failed in $dir"; continue; } - if git -C "$dir" push; then + if git -C "$dir" push --no-verify; then success "Pushed $dir" else warn "git push failed in $dir (committed locally)" diff --git a/git/push-all b/git/push-all new file mode 100755 index 00000000..b0e274e2 --- /dev/null +++ b/git/push-all @@ -0,0 +1,24 @@ +#! /bin/sh + +die() { + printf '\n\033[31m✗\033[0m %s\n' "$*" >&2 + exit 1 +} + +success() { + printf '\n\033[32m✓\033[0m %s\n' "$*" +} + +info() { + printf '\n\033[32m→\033[0m %s\n' "$*" +} + +find "$(pwd)"/* -name '*.git' -print | sed "s|/.git$||" | sort -u | grep -v .cache | while IFS= read -r line +do + info "$line" + CURRENT_DIR=$line + + git -C "$CURRENT_DIR" push --no-verify 2>&1 + + success "Done." +done