-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy/paste status
, priority
and type
labels from the Renovate repo
#59
Comments
Like to have then at all our repos. Anybody knows how to make that semi automatic? |
This could be a start:
For existing repos, the API1 could be used, for example, there is this EddieHubCommunity/gh-action-open-source-labels Github Actions which relies on xavierchow/github-label-template, but nothing standing out (more on the marketplace https://github.com/marketplace?type=actions&query=repository+label), a small script may be enough for a one time thing. Footnotes |
I've collected the list of our current "basic labels" that we use over on the Renovate repository: Status of issue, hex color code: #1d76db
Type of issue, hex color code: #006b75
Priority, hex color code: #c2e0c6
|
Created them for this repo create_labels.sh#!/usr/bin/env bash
set -euo pipefail
declare -r GH_TOKEN="${GH_TOKEN?}"
declare -r ORG='renovatebot'
declare -rA LABELS=(
['priority-1-critical']='A bad bug or work that is holding up a lot of other important features or fixes'
['priority-2-important']='User-visible bugs or very important features'
['priority-3-normal']='Default priority, \"should be done\" but isn'\''t prioritised ahead of others'
['priority-4-low']='Low priority, unlikely to be done unless it becomes important to more people'
['priority-5-triage']='Needs Priority triage and a new priority label assigned'
['status:blocked']='Issue is blocked by another issue or external requirement'
['status:in-progress']='Someone is working on implementation'
['status:ready']='Ready to start implementation'
['status:requirements']='Full requirements are not yet known, so implementation should not be started'
['status:waiting-on-response']='Waiting on a response/more information from the user'
['type:bug']='Bug fix of existing functionality'
['type:docs']='Documentation'
['type:feature']='Feature (new functionality)'
['type:help']='Issues which should be converted to discussion'
['type:refactor']='Refactoring or improving of existing code'
)
function get_repos() {
local -n arr="${1}"
# List all repos in the organization
# shellcheck disable=SC2034
# while IFS=$'\n' read -r repo; do arr+=("${repo}"); done < <(
# curl --silent --show-errors --fail \
# "https://api.github.com/orgs/${ORG}/repos" \
# --request GET \
# --header 'Accept: application/vnd.github.v3+json' \
# --header "Authorization: Bearer ${GH_TOKEN}" \
# | jq --raw-ouput '.[].name'
# )
arr=('renovate-approve-bot-bitbucket-cloud')
return 0
}
function get_color() {
local kind=${1}
case "${kind}" in
status:*)
echo '1d76db'
;;
type:*)
echo '006b75'
;;
priority-*)
echo 'c2e0c6'
;;
*)
printf 'Error: Unknown kind %s\n' "${kind}" >&2
return 1
;;
esac
return 0
}
function main {
local -a repos
local repo label
get_repos repos
for repo in "${repos[@]}"; do
for label in "${!LABELS[@]}"; do
if ! curl --fail "https://api.github.com/repos/${ORG}/${repo}/labels" \
--request POST \
--header 'Accept: application/vnd.github.v3+json' \
--header "Authorization: Bearer ${GH_TOKEN}" \
--data "{
\"name\": \"${label}\",
\"color\": \"$(get_color "${label}")\",
\"description\": \"${LABELS[${label}]}\"
}"; then
printf 'Error: Could not create label %s. It may already exist.\n' "${label}" >&2
fi
done
done
}
main "${@}" |
Oh wow, that's really cool! 😄 👍 I'll go apply the new labels to our existing issues. |
The Maybe there's a problem in the code that creates the ['priority-3-normal']='Default priority, "should be done" but isn'\''t prioritised ahead of others' |
These descriptions are wrong: // Current code:
['type:refactor']='Issues which should be converted to discussion'
['type:help']='Refactoring or improving of existing code' It should be: // Improved code:
['type:refactor']='Refactoring or improving of existing code'
['type:help']='Issues which should be converted to discussion' |
status
, priority
and type
labels from the Renovate repo?status
, priority
and type
labels from the Renovate repo
Oops I fixed these labels |
@maxbrunet Thank you for fixing the script and the labels! 🥳 Can we put this script in a new repository under our organization? That way we can grab the script when we're making a new repository and get the labels set-up correctly. If the organization default labels change, they can be changed with a PR to the script repository. Or we could let @rarkins set up the default labels for the organization? 1 Footnotes |
i prefer our |
I totally forgot about that repository! 🙈 It should go in there! 😉 |
The script is very basic and does not support updating labels, so even if it was a fun exercise to write it, I do not think we should use it. What about this Probot app: https://github.com/probot/settings? It supports configuring nearly everything including labels via PR, and inheritance from the Edit: Looks like there is an issue, the inheritance has never been working |
We could still put the script in |
Right now we have very basic labels like
bug
,enhancement
etc.I'd like to have these labels copied from the Renovate bot repository:
status:
type:
priority
What do you think? Do you want the labels to be the same, or are you happy with just the basic labels?
I don't have the rights to create labels, so these will need to be copy/pasted by someone with
write
level rights.The text was updated successfully, but these errors were encountered: