using someone else token
Created by: iamntz
Having this issue on two different servers, one with latest stable, one with latest master branch. So, i'm using this post-commit script (found somewhere here, not exactly remember where):
#!/bin/sh
PRIVATE_TOKEN=`git config --get gitlab.token`
GITLAB_URL=`git config --get gitlab.url`
URL=`git config --get remote.origin.url`
PROJECT=`basename ${URL} .git | cut -d':' -f2`
bugfix=$(git log -1 HEAD --pretty=format:%s | grep -i -e "[(close|closes|fix|fixes)] #[0-9]\+" | cut -d'#' -f2)
if [ "${bugfix}" != "" ] && [ ${bugfix} > 0 ]
then
curl -# -X PUT -d "closed=1" ${GITLAB_URL}api/v2/projects/${PROJECT}/issues/${bugfix}/?private_token=${PRIVATE_TOKEN} -o /dev/null
rm 0
fi
Of course, i configured gitlab.token
with the token i found in the profile page and gitlab.url
with the real URL of the server.
This script automatically search for patterns like close #123
to close issue 123
. While this works excellent, i noticed that issues are kind of closed by random users.
Although I'm expecting that issue to have me as the one that close it, i often found that is closed by users that are not even assigned to current project.
Am I doing it something wrong? Something is wrong with my bash code?
Thanks!