Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kagof/trello-link-github-action

GitHub action to link a commit, pull request, or issue to a Trello card
https://github.com/kagof/trello-link-github-action

action actions power-up trello trello-api

Last synced: 17 days ago
JSON representation

GitHub action to link a commit, pull request, or issue to a Trello card

Awesome Lists containing this project

README

        

# Trello Link GitHub Action

![Latest Release](https://img.shields.io/github/v/release/kagof/trello-link-github-action)

View on the [GitHub Marketplace](https://github.com/marketplace/actions/trello-link-github-action)

Trello has a [Power-Up to link GitHub commits, pull requests, branches, or issues to a card](https://trello.com/power-ups/55a5d916446f517774210004/github), however, this must be done manually. This action allows you to link a commit, pull request, or issue to a Trello card automatically by using Trello card identifiers in a commit message, pull request title or body, or issue title or body.

The Trello card `id`, `shortLink`, or `idShort` may be used in the tag. The `idShort` (ie, card number) is the easiest to use (in my opinion), assuming you use the Card Number plugin as described [here](#trello-board).

## Usage

### GitHub Repository Action

In your repository, create an action workflow with the following step:

```yaml
- name: Link to Trello
uses: kagof/[email protected]
with:
# Required.
# Allowed to be one of the following:
# 1. the board name
# 2. the board shortLink (can be found in the URL)
# 3. the boardId (can be found via the Trello REST API)
board-identifier: "${{ secrets.BOARD_IDENTIFIER }}"
# Required
# Secret token used to contact Trello
trello-token: "${{ secrets.TRELLO_TOKEN }}"
# Optional (default 'TRELLO-')
# When preceding a string in a commit message or PR body or title,
# indicates that the string is a Trello shortId.
# May be either:
# 1. an alpha string, eg TRELLO
# 2. an alpha string followed by a dash, eg TRELLO-
# 3. one of the characters ! @ # $ % ^ & * + = (note: must be exactly 1 char long)
marker: 'TRELLO-'
```

This action may be triggered on commits, pull requests, or issues.

#### Token

A Trello token is required for this action. To generate it, visit https://trello.com/1/authorize?response_type=token&scope=read,write&name=Trello+Link+GitHub+Action+Token&expiration=never&key=09045f0c83d151e8d48ec9feb99e78ae in your browser, or adjust the name and expiration parameters in this URL to your liking.

**KEEP THIS TOKEN SECRET**. It can be used to change or read data on any of the Trello boards you have access to. You should add it as a secret in your repository.

You may revoke this token at any time from your account settings page in Trello.

### Trello Board

In your Trello board, it is recommended that you add the following Power-Ups:

1. [Card Numbers by Reenhanced](https://trello.com/power-ups/59c3d177178a761767b49278/card-numbers-by-reenhanced) - this lets you easily see the Trello card's shortId.
2. [GitHub](https://trello.com/power-ups/55a5d916446f517774210004/github) - this completes the integration with Trello

After doing so and properly configuring them, your cards will look something like this:

![Example Card](eg/example-card.png)

Note the `#19` - this is the Trello shortId for this card.

### Commits, Pull Requests, and Issues

When opening commits, put your tag anywhere in the commit message. When opening pull requests or issues, place it anywhere in your title or body.

As long as there is a word break, your tag will be picked up. If your marker is a special character, the word break is not necessary. Multiple tags are allowed. Tags can use the card `id`, `idShort`, or `shortLink`.

For Example, if your marker is `TRELLO-`:

#### Valid

* `TRELLO-19 fixes that problem`
* `TRELLO-19: fixes that problem`
* `TRELLO-1234567890abcdefg1234567 using the card ID`
* `TRELLO-AbcDeFga using the card shortLink`
* `fixes TRELLO-19 and TRELLO-18`
* `fix/TRELLO-19-fix-the-stuff`
* `TRELLO-19,TRELLO-18`

#### Invalid

* `fixTRELLO-19`
* `TRELLO-19fixes`

## Known Shortcomings

* If this action runs on a pull request, the commits in the PR are not considered during the run. This can be worked around by running the action on commits as well.
* Branch are not (yet?) considered