Listen to git commits for a specific repo and run a shell command
Rust 100.0%
37 1 0

Clone this repository

https://tangled.org/vielle.dev/tangled-on-commit
git@tangled.org:vielle.dev/tangled-on-commit

For self-hosted knots, clone URLs may differ based on your setup.

README.md

tangled-on-commit#

Run a shell command whenever a specific repo gets a commit

$ tangled-on-commit @vielle.dev/tangled-on-commit ./commit.sh

Created for linux. Should work fine on MacOS. Will not work on windows.
Note: The shell command is placed inside /bin/sh -c "COMMAND", so make sure to escape quotes and backslashes. I reccomend executing a shell file and piping stdout and stderr to a log file

Installation#

Prerequisites:

  • Git
  • Rust (1.88+)
  • Cargo
  • OpenSSL (required for ssl connection)
  • pkg-config (required for ssl connection)
  1. Clone this repo:
    git clone git@tangled.sh:vielle.dev/tangled-on-commit
  2. Compile the binary:
    cargo build --release
  3. Copy the binary to your path:
    sudo cp ./target/release/tangled-on-commit /bin

Usage#

CLI Arguments#

  • tangled-on-commit (-h | --help)
    Displays this message

  • tangled-on-commit
    No specified handle, repo, or command. Falls back to config/env

  • tangled-on-commit SHELL
    Uses config/env for handle and repo

  • tangled-on-commit @HANDLE SHELL
    Uses config/env for repo

  • tangled-on-commit REPO SHELL
    Uses config/env for handle

  • tangled-on-commit @HANDLE/REPO SHELL
    tangled-on-commit HANDLE REPO SHELL
    No config/env

JSON#

Loads the file tangled-on-commit.json from cwd if it exists. Reads keys "handle", "repo_name", and "shell". Unknown keys are ignored and any key can be ommitted JSON is used if the arguments aren't passed to the CLI

Env#

Loads the environment variables TANGLED_ON_COMMIT_HANDLE and TANGLED_ON_COMMIT_REPO_NAME Shell cannot be set by environment variables. Env variables are used if relevant keys are ommitted an arguments aren't passed to the CLI.