Pivotal Tracker can parse git commits and change ticket status accordingly. I am writing a PHP script that executes post-commit. It searches the commit message and if it finds the right Pivotal Ticket reference it posts it to the PT api. I'm going a bit nuts trying to figure out the regex.
Currently I have:
preg_match('/^\[#([0-9]{1,16})\]/', $commit['message'], $matches);
So the simplest example of a commit passes:
[#12345678] Made a commit
But what I need to pass are the following:
1: [finished #12345678] Made a commit //'fixed', 'complete', or 'finished' changes the status
2: I made a commit [#12345678] to a story //Can occur anywhere in the commit