{"id":22668057,"url":"https://github.com/btoll/gh-hooker","last_synced_at":"2025-03-29T10:28:22.781Z","repository":{"id":267175811,"uuid":"900423268","full_name":"btoll/gh-hooker","owner":"btoll","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-01T18:44:54.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T09:17:02.324Z","etag":null,"topics":["gh-extension"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-08T18:29:29.000Z","updated_at":"2024-12-27T04:04:52.000Z","dependencies_parsed_at":"2024-12-25T22:32:29.652Z","dependency_job_id":null,"html_url":"https://github.com/btoll/gh-hooker","commit_stats":null,"previous_names":["btoll/gh-hooker"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btoll%2Fgh-hooker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btoll%2Fgh-hooker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btoll%2Fgh-hooker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btoll%2Fgh-hooker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btoll","download_url":"https://codeload.github.com/btoll/gh-hooker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246171145,"owners_count":20734961,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gh-extension"],"created_at":"2024-12-09T15:13:38.898Z","updated_at":"2025-03-29T10:28:22.758Z","avatar_url":"https://github.com/btoll.png","language":"Shell","readme":"# `gh-hooker`\n\n- [About](#about)\n    + [`git-init-wrapper`](#git-init-wrapper)\n    + [`git-hooks`](#git-hooks)\n    + [`git-bootstrap`](#git-bootstrap)\n- [Installation](#installation)\n    + [`gh`](#gh)\n    + [`podman`](#podman)\n    + [tar](#tar)\n- [Usage](#Usage)\n\n---\n\n# About\n\nThis extension provides three custom Git extensions:\n\n- `git-init-wrapper`\n- `git-hooks`\n- `git-bootstrap`\n\n## `git-init-wrapper`\n\nUse this extension when a Git repository should be initialized.  It will do the following things:\n\n- Initialize the new repository (`git-init`).\n- Install pre-defined bootstrap files that should be copied into each new repository.\n- Optionally install one or more groups of Git hooks scripts, defined by language:\n    + `go`\n    + `js`\n    + `python`\n    + `_`\n        - This is a catch-all.\n    + Each group contains symlinks to security tools such as [`ggshield`](https://github.com/GitGuardian/ggshield) and [`Trivy`](https://github.com/aquasecurity/trivy).\n\n## `git-hooks`\n\nUse this extension when installing Git hooks into an existing repository.\n\n## `git-bootstrap`\n\nUse this extension when installing bootstrap files into an existing repository.\n\n# Installation\n\n## `gh`\n\n```bash\ngh extension install btoll/gh-hooker\n```\n\n```bash\ngh hooker\n```\n\nThis will copy custom Git extensions and Git hooks to `$HOME/.local/bin/gh-hooker`.  In addition, files that are common to all repositories of an organization are copied to `$HOME/.local/share/gh-hooker`.\n\nThe hooks are configured locally.  The global `.gitconfig` is untouched.\n\n## `podman`\n\n```bash\npodman run --rm -v \"$HOME/.local\":/root/.local docker.io/btoll/gh-hooker:latest\n```\n\n## tar\n\nCreate the tarball:\n\n```bash\ntar -cjf gh-hooker_0.1.0.bz2 --exclude .git gh-hooker\n```\n\nUnpack:\n\n```bash\ntar -xjf gh-hooker_0.1.0.bz2\ncd gh-hooker\nmkdir -p \"$HOME\"/.local/{bin,share}/gh-hooker\ncp -r {bin,hooks} \"$HOME\"/.local/bin/gh-hooker/\ncp -r bootstrap \"$HOME\"/.local/share/gh-hooker/\nexport PATH=\"$PATH\":\"$HOME\"/.local/bin/gh-hooker/bin\n```\n\n# Usage\n\nInitialize a new Git repository, copy bootstrap files to it and install Git hooks:\n\n```bash\ngit init-wrapper -d my-new-repo --hooks go\n```\n\nList the installed hooks:\n\n```bash\ngit config --local --get-all hooks.pre-commit.hook\nggshield.sh\ngo-fmt.sh\ngo-vet.sh\nhadolint.sh\nshellcheck.sh\ntrivy.sh\n```\n\nList the installed scripts:\n\n```bash\n$ ls .git/hooks/pre-commit.d\nf.sh  ggshield.sh  go-fmt.sh  go-vet.sh  hadolint.sh  shellcheck.sh  trivy.sh\n```\n\n\u003e `f.sh` is a helper script.\n\nMultiple hooks are separated by commas:\n\n```bash\ngit init-wrapper -d my-new-repo --hooks _,go,python\n```\n\nCopy bootstrap files into an existing repository:\n\n```bash\ncd my-new-repo\ngit bootstrap\n```\n\nCopy Git hooks into an existing repository:\n\n```bash\ncd my-new-repo\ngit hooks -t go\n```\n\nMultiple hooks are separated by commas:\n\n```bash\ngit hooks -t _,go,python\n```\n\n---\n\nNote that `ggshield` can install its own `pre-commmit` hook:\n\n```bash\nggshield install [OPTIONS]\n```\n\n[ggshield install](https://docs.gitguardian.com/ggshield-docs/reference/install)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtoll%2Fgh-hooker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtoll%2Fgh-hooker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtoll%2Fgh-hooker/lists"}