8000 GitHub - awesome-os/github-hooks: Org-wide GitHub push whitelist & local-forge mirror hooks (LFS text-pointers only, zero experimental leaks) · GitHub
[go: up one dir, main page]

Skip to content

About

Org-wide GitHub push whitelist & local-forge mirror hooks (LFS text-pointers only, zero experimental leaks)

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

13 Commits

Folders and files

Repository files navigation

awesome-os/github-hooks

Org-wide GitHub push whitelist & local-forge → GitHub mirror hooks for AwesomeOs — keeping experimental/private branches strictly local while mirroring only approved repositories to GitHub with text-only LFS pointers.

(Paired with awesome-os/github-runner. Named github-hooks intentionally so private/internal git-hooks remain cleanly separated.)


Architecture — 4-Pillar Sovereign Forge Flow

flowchart LR
  WT["Worktrees<br/>E:\awesome-os.worktrees\*"] -->|"git push local-forge"| FORGE["Sovereign Local Forge<br/>E:\awesome-os.git"]
  FORGE -->|"binary blobs"| LFS["Local LFS Store<br/>E:\awesome-os.lfs"]
  FORGE -->|"hooks/post-receive<br/>(forge-mirror.conf whitelist)"| GATE{"Whitelisted<br/>ref?"}
  GATE -->|"Yes (GIT_LFS_SKIP_PUSH=1)"| GH["GitHub Public Repos<br/>(commits + text LFS pointers only)"]
  GATE -->|"No (experimental / private)"| LOCAL["Stays 100% Local<br/>in E:\awesome-os.git"]
Loading

Files in This Repository

File Role
forge-mirror.conf Single source of truth for allowed GitHub mirrors (<local-forge-ref> <github-url> <github-target-ref>).
hooks/post-receive Server-side bare forge hook: triggered on every push to E:\awesome-os.git. Mirrors only refs listed in forge-mirror.conf to GitHub with GIT_LFS_SKIP_PUSH=1, blocks auto-deletion of remote branches, and keeps all unlisted branches private.
hooks/pre-push Client & github-runner guard: intercepts direct git push to any github.com remote and rejects any ref not whitelisted in forge-mirror.conf. Pushes to local-forge are always allowed.
install-hooks.ps1 Windows PowerShell installer for both bare local forges (-Forge) and client/runner core.hooksPath (-Global or repo-local).
install-hooks.sh POSIX /bin/sh installer for Linux, macOS, and awesome-os/github-runner containers.

Quick Start

1. Install on Your Sovereign Bare Forge (E:\awesome-os.git)

# From E:\awesome-os.worktrees\github-hooks
.\install-hooks.ps1 -Forge E:\awesome-os.git
# Linux / macOS bare forge
./install-hooks.sh --forge /srv/awesome-os.git

Then configure each worktree/repo to push to local-forge:

git remote add local-forge E:\awesome-os.git
git config remote.local-forge.push refs/heads/main:refs/heads/repositorys/main
git push local-forge

What happens on git push local-forge:

  1. E:\awesome-os.git receives your commit and auto-updates its checked-out worktree (receive.denyCurrentBranch=updateInstead).
  2. Any binary assets tracked by Git LFS stay in E:\awesome-os.lfs.
  3. hooks/post-receive checks forge-mirror.conf:
    • Matched: pushes ${newrev}:${target_ref} to GitHub with GIT_LFS_SKIP_PUSH=1 (text LFS pointers only).
    • Not matched: prints local-only (not in forge-mirror.conf) — kept private in local forge and never touches GitHub.

2. Install as Client / Workstation Guard (hooks/pre-push)

Prevents accidental direct pushes of experimental/scratch branches to github.com:

# Repo-local
.\install-hooks.ps1

# Machine-wide (all repos)
.\install-hooks.ps1 -Global
./install-hooks.sh --global

3. Integration with awesome-os/github-runner

awesome-os/github-runner natively supports awesome-os/github-hooks via --install-hooks and logs [github-hooks] ACTIVE at runner startup:

node runner-core.mts --install-hooks

You can also point any runner container at a custom checkout via AWESOME_GITHUB_HOOKS_DIR=/path/to/github-hooks/hooks.


Whitelist Format (forge-mirror.conf)

# <local-forge-ref>                   <github-remote-url>                                    <github-target-ref>
refs/heads/repositorys/main           https://github.com/awesome-os/repositorys.git           refs/heads/main
refs/heads/org/github-hooks           https://github.com/awesome-os/github-hooks.git          refs/heads/main
refs/heads/org/github-runner          https://github.com/awesome-os/github-runner.git         refs/heads/main
refs/heads/org/win-omarchy            https://github.com/awesome-os/win-omarchy.git           refs/heads/main
  • Blank lines and # comments are ignored.
  • Branch deletions (0000000000000000000000000000000000000000) are never forwarded to GitHub.
  • If GitHub is unreachable (offline work), post-receive logs a warning and exits 0 so your local push is never blocked.

Environment Variables

Variable Default Effect
GIT_FORGE_NO_GITHUB 0 Set to 1 to skip GitHub mirroring during offline or batch pushes to local-forge.
GIT_FORGE_MIRROR_CONF auto-detected Explicit path to forge-mirror.conf (overrides $GIT_DIR/forge-mirror.conf and ../forge-mirror.conf).
GIT_GITHUB_HOOKS_ALLOW 0 Set to 1 as an explicit one-shot override for hooks/pre-push.
AWESOME_GITHUB_HOOKS_DIR auto-detected Used by awesome-os/github-runner to locate the hooks/ directory.

License

SPDX-License-Identifier: BSD-3-Clause

About

Org-wide GitHub push whitelist & local-forge mirror hooks (LFS text-pointers only, zero experimental leaks)

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0