Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release
### Security
### 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
- 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
Expand Down Expand Up @@ -42,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
Expand Down
70 changes: 70 additions & 0 deletions git/ignore-changelog
Original file line number Diff line number Diff line change
@@ -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 --no-verify; then
success "Pushed $dir"
else
warn "git push failed in $dir (committed locally)"
fi
done
24 changes: 24 additions & 0 deletions git/push-all
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions git/reset-all
Original file line number Diff line number Diff line change
@@ -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
Loading