Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine post-merge hook script #330

Open
philhagen opened this issue Jul 21, 2024 · 1 comment
Open

Refine post-merge hook script #330

philhagen opened this issue Jul 21, 2024 · 1 comment
Assignees
Milestone

Comments

@philhagen
Copy link
Owner

Add conditional handling so e.g. logstash only restarts if its configuration files changed, etc.

See https://stackoverflow.com/questions/4877306/list-changed-files-in-git-post-merge-hook

@philhagen philhagen self-assigned this Jul 21, 2024
@philhagen philhagen added this to the Q3CY2024 milestone Jul 21, 2024
@philhagen
Copy link
Owner Author

possibly better approach:

#!/bin/bash

# Get the list of changed files
changed_files=$(git diff --cached --name-only)

# Check if specific files are changed
if echo "$changed_files" | grep -q "path/to/specific/file.txt"; then
    # Run your desired command
    echo "Specific file changed, running checks..."
    # For example, run linters or tests
    # ...
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant