jeffmccune/puppet-webhooks — pull request #15 by jeffmccune (2013-02-05 06:09:55+00:00)
Title: Search multiple boards and archive a card when a PR is closed

Without this patch the app takes no action when a pull request is
closed. This is a problem because we often need to manually manage the
card on Trello.

This patch addresses the problem by searching for the card on the
primary board containing the list ID. If the card is not found, the app
additionally searches for cards located on the boards identified by the
TRELLO_BOARDS environment variable which is expected to contain a comma
separated list of board identifiers.

This patch does not make any effort to figure out why the pull request
was closed. It simply finds the card associated with the pull request,
adds a comment, and archives the card.

Finally, the behavior of the find_card method is changed by this patch.
An identifier located inside the parentheses and matching the regular
expression /\(PR .*/\d+\)/ will be extracted from the name passed to
find_card. This substring will then be compared against all the card
titles on the multiple boards.