Poor-man's smart commits in Stash using post-receive git hook

Noah Zucker May 5, 2014

Due to STASH-2826 and related tickets, we potentially need to write our own custom post-receive web hook that only logs work (along with a work description).


Requirements


1) User "Fred" commits and pushes the following on branch FOO-123

git commit -m"FOO-123 #time 30m Fixed issue."

2) Script uses JIRA rest api to log 30 minutes to FOO-123 with description "Fixed issue" - as the user who logged authored the commit.

Note: We only use #time. We don't at this time use transition keywords.

3) Script ignores (does not process) commits that begin with a specified pattern, i.e.

Merge pull request #\d+ in PROJECT/reponame from

(This is a work-around for STASH-2826)

The main problem I envision is that the REST API will probably not let you log work for another user? I have not seen a way to do so via the normal web interface.

Just wondering if someone out there has already implemented this and would like to share. If not, we may end up doing so and posting the result here.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Stefan Saasen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2014

Hi Noah,

After talking to someone from the JIRA team it looks like using REST API wouldn't work as it'd always be in the context of the user executing the request :/ It looks like STASH-2826 (or something along those lines) is going to be the best bet for now.

Sorry to not have better news.

Cheers,

Stefan

0 votes
Benjamin Mueller March 8, 2015

Hey Noah,

I think the plugin Smart Commits for Stash could be useful for you. I have started the development last year. Now the basic function-set is complete. What is your opinion about the current functionality? Do you have any use case which you would like to see in further releases?

If you have further questions please contact me.

Cheers,

Benni

TAGS
AUG Leaders

Atlassian Community Events