update-slack-users
БесплатноБез исполняемых скриптовНе проверенUpdate .github/slack-users.json, the GitHub login to Slack member ID map that CI alerts use to tag people. Use when a maintainer joins or leaves, when a CI…
от mastra-ai★ 29 944 звезды на GitHubОб этом скилле
Update the GitHub → Slack user map
.github/slack-users.json maps GitHub logins to Slack member IDs:
{
"octocat": "U012AB3CD4E"
}
CI alerts look GitHub logins up in this file. One example is the test-tier escape alert built by scripts/test-tiers/attribute.mjs. A listed login becomes a Slack tag (<@U012AB3CD4E>), and an unlisted one is printed as a plain @login. So a missing entry is harmless, but a wrong entry tags the wrong person. Leave someone out rather than guess.
Who an alert tags: the author of the PR that broke something. When a bot opened that PR, the alert tags a person instead: the human who merged it, then the humans who approved it, then the human credited on the most commits (including Co-authored-by trailers). It falls back to @here only when it can't tell who the person is. So the map needs everyone who authors, merges or approves PRs on main, everyone co-credited on main, and everyone credited on a bot PR's own commits.
What you need
- The workspace's Slack user list, from someone with a token that has the
users:readscope. That is the only scope the steps below need: matching never uses emails, sousers:read.emailisn't needed. The token holder can run step 2 and hand you the resulting file, or setSLACK_TOKENin your environment. Never print the token, write it to a file, or put it in a commit or PR. gh, authenticated with read access to this repo, andjq.
If you hold the token yourself, check it before anything else:
curl -sS -H "Authorization: Bearer $SLACK_TOKEN" https://slack.com/api/auth.test | jq '{ok, error, team}'
ok: false with missing_scope or invalid_auth means stop and ask for a token with users:read.
Steps
1. List the GitHub logins that need an entry
Take the last 90 days. gh writes colour codes into --jq output when CLICOLOR_FORCE is set, which breaks the jq calls below, so run unset CLICOLOR_FORCE first. GitHub search returns at most 1,000 PRs per query and main merges more than that in 90 days, so query one week at a time. GitHub sometimes answers 502 or 504, so each week is retried; if a week still fails, the loop stops. Don't continue with a gap.
work=$(mktemp -d)
(
for w in $(seq 0 12); do
from=$(date -u -v-$(( (w+1)*7 ))d +%F 2>/dev/null || date -u -d "$(( (w+1)*7 )) days ago" +%F)
to=$(date -u -v-$(( w*7 ))d +%F 2>/dev/null || date -u -d "$(( w*7 )) days ago" +%F)
for try in 1 2 3 4; do
gh pr list --repo mastra-ai/mastra --state merged --base main --limit 1000 \
--search "merged:$from..$to" --json number,author,mergedBy,reviews \
> "$work/week-$w.json" && break
[ "$try" = 4 ] && { echo "week $w failed: stop and run step 1 again" >&2; exit 1; }
sleep 10
done
done
)
If it prints week ... failed, stop: the list is missing that week.
Take the authors, mergers and approvers from those PRs, and note which PRs a bot opened:
jq -r '.[] | (.author.login, .mergedBy.login, (.reviews[] | select(.state=="APPROVED") | .author.login)) // empty' \
"$work"/week-*.json > "$work/prs.txt"
jq -r '.[] | select(.author.is_bot) | .number' "$work"/week-*.json | sort -un > "$work/bot-prs.txt"
For a bot PR, the alert's last rung credits the people on the PR's own commits: each commit's author, and each Co-authored-by noreply address in its message. A squash merge can drop both from main, so read them from each bot PR's commits. Every page is fetched, a failing PR is retried, and the loop stops if it still fails:
(
while read -r pr; do
for try in 1 2 3 4; do
gh api --paginate --slurp "repos/mastra-ai/mastra/pulls/$pr/commits?per_page=100" > "$work/commits.json" && break
[ "$try" = 4 ] && { echo "commits of #$pr failed: stop and run this step again" >&2; exit 1; }
sleep 10
done
jq -r 'add[] | (.author.login // empty), (.commit.message | scan("(?im)^co-authored-by:.*<(?:[0-9]+\\+)?([^@<>\\s]+)@users\\.noreply\\.github\\.com>\\s*$") | .[0])' \
"$work/commits.json" || exit 1
done < "$work/bot-prs.txt"
) > "$work/bot-commits.txt"
If it prints commits of ... failed, stop: the list is missing that PR's people.
Then add co-authors credited on main through GitHub noreply addresses, both <id>+<login>@users.noreply.github.com and the older <login>@users.noreply.github.com (the same forms the alert reads). If the fetch fails, stop rather than read a stale origin/main:
git fetch -q origin main || { echo "fetch failed: stop" >&2; false; } &&
git log origin/main --since=90.days --format=%B \
| grep -ioE '^co-authored-by:.*<([0-9]+\+)?[^@<>[:space:]]+@users\.noreply\.github\.com>' \
| sed -E 's/.*<([0-9]+\+)?([^@<>[:space:]]+)@.*/\2/' > "$work/coauthors.txt"
Keep only people, with their GitHub profile name. gh pr list drops the [bot] suffix from app accounts, so you can't spot them by name. Ask GitHub for each login's account type in
Установить update-slack-users в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл update-slack-users?
Update .github/slack-users.json, the GitHub login to Slack member ID map that CI alerts use to tag people. Use when a maintainer joins or leaves, when a CI alert shows a plain @login instead of a Slack tag, or when asked to refresh the map. Needs a Slack token that can read the workspace's user list.
Как установить скилл update-slack-users?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл update-slack-users запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub