Last active
January 11, 2021 15:25
-
-
Save ilyash-b/afb356815d9f715ea9e7eef796751f70 to your computer and use it in GitHub Desktop.
[trello] Add prefix to all cards on personal board in given list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ngs | |
F main(list_name:Str) { | |
AUTH = "?key=${ENV.TRELLO_API_KEY}&token=${ENV.TRELLO_API_TOKEN}" | |
board = ``curl -s "https://api.trello.com/1/members/me/boards${AUTH}"``.the_one({"name": /personal/}) | |
list = ``curl -s "https://api.trello.com/1/boards/${board.id}/lists${AUTH}&cards=open"``.the_one({"name": list_name}) | |
tag = list.name.split(' ')[0] | |
pfx = "[${tag}] " | |
list.cards.reject({'name': Pfx('[')}).each(F(card) { | |
echo("${card.name} -> ${pfx}${card.name}") | |
$(curl -X PUT "https://api.trello.com/1/cards/${card.id}${AUTH}&name=${encode_uri_component("${pfx}${card.name}")}") | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment