Created
January 11, 2022 19:36
-
-
Save stefanzweifel/9fd52c6fc2af89048cf0119241c06dd7 to your computer and use it in GitHub Desktop.
Shell script to add `changelog:x` labels to a repository. (See blog post for detail how I use this: https://stefanzweifel.io/posts/2021/11/13/introducing-the-changelog-updater-action#content-approaches-to-auto-generate-release-notes)
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
#!/bin/bash | |
set -e | |
# NOTE to create labels for your repo | |
# to support types from commit message guide (feat, fix, docs, style, refactor, test, chore) | |
# by hitting GitHub API v3 | |
# | |
# https://developer.github.com/v3/issues/labels/#create-a-label | |
# https://gist.github.com/caspyin/2288960 | |
# 1. Create your github PERSONAL ACCESS TOKEN at https://github.com/settings/tokens | |
# 2. Enter these fields | |
GH_TOKEN='TOKEN_GOES_HERE' | |
USERNAME='stefanzweifel' | |
REPO='REPO_NAME' | |
# 3. Hit GitHub API | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:added","color":"0E8A16"}' | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:changed","color":"5319E7"}' | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:dreprecated","color":"000000"}' | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:fixed","color":"0E8A16"}' | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:removed","color":"D93F0B"}' | |
curl -f -X POST https://api.github.com/repos/$USERNAME/$REPO/labels -H "Authorization: token $GH_TOKEN" -d '{"name":"changelog:security","color":"FBCA04"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment