So I'm looking for a solution to such a case:
a file with a specific name pattern (say AB_123.sql) is commited to the repository. If the filename differs from the mentioned pattern I'd need a thread to be created. I can cope with the regexp but I'd need a direction as for where to start.
Initially I figured I could probably achieve what I need with a custom hook. So I'd need to write a script that:
- lists all the files of the last commit,
- checks if there is a file with a certain name pattern,
- if so, creates a thread under this commit in gitlab.
For now I have come up with something like this:
LAST_COMMIT=$(git rev-parse --verify HEAD)
COMMITED_FILES=$(git diff-tree --no-commit-id --name-only -r $LAST_COMMIT)
echo $COMMITED_FILES
if [[ "$COMMITED_FILES" == *"blabla1"* ]]; then
echo "[INFO]: File(s) found. Creating thread..."
else
echo "[INFO]: No files with the specified name pattern found"
fi
What's left here is actually make the script create a thread under this commit when there is a file with specified name patter found.
Yet I cannot find anything on the topic of threads creation with a git command. Is there any?