OpenSearch
OpenSearch copied to clipboard
[Feature Request] Define GitHub labels in a file in source control
Is your feature request related to a problem? Please describe
GitHub labels can be added and removed by repo ~admins~ maintainers, but there's no clear process for how new labels get added or removed. If they were defined in a file in source control, then label additions/removals could happen via the PR process. Any contributor could propose a change and that could be discussed via the PR.
Describe the solution you'd like
There is a GitHub action that provides this functionality: https://github.com/marketplace/actions/manage-github-labels
Related component
Other
This would be awesome project-wide.
@andrross this is a good suggestion but maintainers should be able to create new labels as well and they don’t need to rely on admin.
I like this idea. It would be helpful to add the backport X.Y label to all of the components when the version increment runs.
@andrross how can we use this source control based labeling to define a base set of labels at the project level? All repos should inherit those labels for consistency - in addition, repo maintainers can define a few extra labels at their repo level.
@Pallavi-AWS The quickest way I see to do this is to define the common labels in the .github repo, then each repo in the project adds a github action like the following:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Synchronize labels
uses: julbme/gh-action-manage-label@v1
with:
from: |
https://raw.githubusercontent.com/my-org/my-repositorty/path-to-folder-with/common-labels.yml
.github/config/labels.yml
.github/config/other-labels.yml
skip_delete: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
where the https://raw.githubusercontent.com/my-org/my-repositorty/path-to-folder-with/common-labels.yml file is the common file defined in the .github repo.
This should be quick and easy, with the only hangup is that it has to happen in every repository.
@andrross can't we take advantage of https://github.com/opensearch-project/project-meta?tab=readme-ov-file#create-or-update-labels-in-all-repos and manage it globally?
@bbarani Yes, we can. If the goal is that all repositories just have a common base set of labels, then we can define them in a base repository and build something (maybe a github action) that will use a CLI tool like what you linked to create them in every repo. Then each repo is free to add or remove additional labels however they like.
However, if the goal is to have source files be the authoritative source of truth for labels (that was kind of the intent of this issue), then we'd want something like what I previously linked because it will remove any labels that were created out-of-band.
I think we could potentially do both. As long as any repo that opts in to using the gh-action-manage-label action includes the correct base list of labels that would be automatically added by the first process.
@andrross Also came across this GH action which lets you define different label groups and then mapping of repo to label group. It seems like for this to work it needs shared secret token at org level which will have permissions to read/write to different repos in that org. Not completely sure on the permission model here.
FWIW I was trying to play with gh-action-manage-label and seems like there is some issue while parsing the common label file when provided as URL vs a local file in repo. Ref: https://github.com/julbme/gh-action-manage-label/issues/1
FWIW I was trying to play with
gh-action-manage-labeland seems like there is some issue while parsing the common label file when provided as URL vs a local file in repo. Ref: julbme/gh-action-manage-label#1
That repo was last updated almost 2 years ago so I wouldn't use it for this purpose.
Actually there was an issue with the configuration of GitHub action which @andrross pointed out. So it is working as expected. I think we can use this GitHub action to keep common set of the labels synced across the repositories and let each repo creates its own as needed too (i.e. with skip_delete: true). At each repo level, the action can be modified to include additional labels config file to be used and by changing the skip_delete: false as it suits different repository needs ?
IMO the requirements are:
- A way to define common labels across all repos in the org by modifying a file in .github.
- A way for each repo to define additional labels in a way that visibly fails when one is trying to override an existing label.
- A way for a new repo to use the above without having to add any GHA.
- (Nice to have) a way of migrating from one label to another.
- (Nice to have) a way of deleting unused labels.