parent
e3a9357deb
commit
dc4a7189b4
4 changed files with 155 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ in
|
|||
build-glove80 = callPackage ./build-glove80.nix { };
|
||||
count-tags = callPackage ./count-tags.nix { };
|
||||
create-script = callPackage ./create-script.nix { };
|
||||
dev-commit = callPackage ./dev-commit.nix { };
|
||||
get-tags = callPackage ./get-tags.nix { };
|
||||
git-exclude = callPackage ./git-exclude.nix { };
|
||||
git-graph = callPackage ./git-graph.nix { };
|
||||
|
|
|
|||
48
packages/dev-commit.nix
Normal file
48
packages/dev-commit.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "dev-commit";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
git
|
||||
logger
|
||||
openssh
|
||||
];
|
||||
|
||||
text = ''
|
||||
IFS=':' read -ra repos <<< "$DEV_COMMIT_PATHS"
|
||||
|
||||
for repo in "''${repos[@]}"; do
|
||||
logger "Processing repository: $repo"
|
||||
|
||||
pushd "$repo" > /dev/null 2>&1
|
||||
|
||||
if [[ -n $(git status --porcelain) ]]; then
|
||||
logger "Changes detected in $repo"
|
||||
|
||||
git status --short | while read -r line; do
|
||||
logger "Changed file: $line"
|
||||
done
|
||||
|
||||
git add .
|
||||
|
||||
if git commit -m "Automated dev commit"; then
|
||||
logger "Commit successful in $repo"
|
||||
|
||||
if git push; then
|
||||
logger "Push successful in $repo"
|
||||
else
|
||||
logger "Push failed in $repo"
|
||||
fi
|
||||
else
|
||||
logger "No changes to commit in $repo"
|
||||
fi
|
||||
else
|
||||
logger "No changes in $repo"
|
||||
fi
|
||||
|
||||
popd > /dev/null 2>&1
|
||||
done
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue