Pivotal Tracker 可以解析 git 提交并相应地更改票证状态。我正在编写一个执行 post-commit 的 PHP 脚本。它搜索提交消息,如果找到正确的 Pivotal Ticket 引用,则将其发布到 PT api。我想弄清楚正则表达式有点疯狂。
目前我有:
preg_match('/^\[#([0-9]{1,16})\]/', $commit['message'], $matches);
因此,提交通过的最简单示例:
[#12345678] Made a commit
但我需要通过的是以下内容:
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