Files
2026-04-25 21:55:07 +01:00

1.0 KiB

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:

repos:
  - repo: https://example.com/your-org/pre-commit-argocd-hooks.git
    rev: v0.1.0
    hooks:
      - id: write-argocd-repo

For local development:

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]