#!/bin/bash

handleSecretChanges() {
  secretsFolderPath="$HOME/.local/share/secrets"

  message=$(yadm log -1 --format="%s")
  hash=$(yadm rev-parse HEAD)

  git --git-dir "$secretsFolderPath/.git" --work-tree "$secretsFolderPath" add .
  git --git-dir "$secretsFolderPath/.git" --work-tree "$secretsFolderPath" commit -m "$message" -m "Issued from YADM by commit '$hash'"
}

handleSecretChanges
