Files
pre-commit-hooks/README.md
T
2026-04-25 21:55:07 +01:00

43 lines
1.0 KiB
Markdown

# pre-commit Argo CD hooks
A small pre-commit hook repository with a base runner and discrete hook scripts under `scripts/<hook-id>/run.sh`.
## Hooks
### `write-argocd-repo`
Creates or overwrites `.argocd/repo` in the repository where the hook is being run, then stages it into the current commit.
The generated file contains:
- `remote_origin_url=<origin-url>`
- `branch=<current-branch-or-short-commit>`
- one `workflow=<filename>` entry for each file directly under `.gitea/workflows`
## Usage
Add this to the consuming repository's `.pre-commit-config.yaml`:
```yaml
repos:
- repo: https://example.com/your-org/pre-commit-argocd-hooks.git
rev: v0.1.0
hooks:
- id: write-argocd-repo
```
For local development:
```yaml
repos:
- repo: local
hooks:
- id: write-argocd-repo
name: Write Argo CD repo metadata
entry: /absolute/path/to/pre-commit-argocd-hooks/scripts/base.sh write-argocd-repo
language: script
always_run: true
pass_filenames: false
stages: [pre-commit]
```