Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #1469

Closed
Open
Created Sep 15, 2012 by Administrator@rootOwner

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!

Assignee
Assign to
Time tracking