rematocorp / trello-integration-action

GitHub action for connecting GitHub PRs and Trello cards — moves cards, adds labels & people, and more
MIT License
18 stars 11 forks source link

Idea: Support for linking multiple Trello cards based on branch name #90

Closed andybardagi closed 6 months ago

andybardagi commented 6 months ago

Currently, the GitHub Action scans the branch name of a pull request to find a single Trello card ID for linking.

To enhance this functionality, I propose extending the action to support scanning multiple Trello card IDs from the branch name. This would allow users to associate a pull request with multiple Trello cards.

For example, a branch named feat/38-user-auth currently links to Trello card ID 38. With the proposed extension, a branch named feat/38-39-user-auth would link to both Trello card IDs 38 and 39.

ukupat commented 6 months ago

Thanks for sharing the idea! Would you like to reference cards on one specific board or, for example, could the 38 card be on board Foo and 39 card on board Bar?

andybardagi commented 6 months ago

Honestly, I haven't thought about it and I haven't tried the multiboard support either. What do you suggest?

ukupat commented 6 months ago

I'm asking because if this feature is intended to work across multiple boards—for instance, at Remato, we manage a dozen backlog boards in addition to one primary board where all tickets are moved—relying solely on Trello card numbers could present unique challenges. Here's how the functionality currently operates:

  1. The action identifies the branch name, such as 38-user-auth.
  2. It then searches for cards using this name via Trello Search API
  3. If no matches are found, it searches again using just the number 38 and takes the most recently updated card.

The issue arises because the number 38 is unique within a single board. With 10 boards to search, the action might locate 10 different cards with number 38, potentially moving the incorrect one. However, limiting the search to a single board (using the idBoards parameter) would ensure the correct card is found.

Thus, this approach of using multiple Trello shortIds seems only reliable when restricted to a single board—or when the action is specifically instructed to search only within a designated board. If this adjustment aligns with your workflow, I'm more than happy to implement it :)

ukupat commented 6 months ago

Soooo, I turned this idea into reality. Try it out by adding github-allow-multiple-cards-in-pr-branch-name: true to your conf (I also recommend setting trello-board-id). Let me know if it doesn't work as expected, @andybardagi

andybardagi commented 6 months ago

Thanks a ton for your swift response and for the quick development. I'm thrilled to let you know that I'm going to test it out right away. I'll provide you with feedback once I've given it a thorough try.

ukupat commented 6 months ago

@andybardagi I found two issues with my implementation (board ID didn't work and only one card was linked to the PR with a comment). I fixed both issues with the latest release 🤞

andybardagi commented 6 months ago

Works like a charm! I tested it with one board id and two cards. Thank you!

ukupat commented 6 months ago

Great to hear that! Don't hesitate to share more ideas in the future, @andybardagi :)