Skip to content
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

[Feature Request] Define GitHub labels in a file in source control #12572

Open
andrross opened this issue Mar 8, 2024 · 12 comments
Open

[Feature Request] Define GitHub labels in a file in source control #12572

andrross opened this issue Mar 8, 2024 · 12 comments
Labels
enhancement Enhancement or improvement to existing feature or request Other

Comments

@andrross
Copy link
Member

andrross commented Mar 8, 2024

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

@andrross andrross added enhancement Enhancement or improvement to existing feature or request untriaged labels Mar 8, 2024
@github-actions github-actions bot added the Other label Mar 8, 2024
@dblock
Copy link
Member

dblock commented Mar 12, 2024

This would be awesome project-wide.

@bbarani
Copy link
Member

bbarani commented Mar 27, 2024

@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.

@cwperks
Copy link
Member

cwperks commented Apr 3, 2024

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.

@Pallavi-AWS
Copy link
Member

@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.

@andrross
Copy link
Member Author

andrross commented May 9, 2024

@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.

@bbarani
Copy link
Member

bbarani commented May 9, 2024

@andrross
Copy link
Member Author

andrross commented May 9, 2024

@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.

@sohami
Copy link
Collaborator

sohami commented May 9, 2024

@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.

@sohami
Copy link
Collaborator

sohami commented May 9, 2024

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: julbme/gh-action-manage-label#1

@bbarani
Copy link
Member

bbarani commented May 9, 2024

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: julbme/gh-action-manage-label#1

That repo was last updated almost 2 years ago so I wouldn't use it for this purpose.

@sohami
Copy link
Collaborator

sohami commented May 10, 2024

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 ?

@dblock
Copy link
Member

dblock commented May 13, 2024

IMO the requirements are:

  1. A way to define common labels across all repos in the org by modifying a file in .github.
  2. A way for each repo to define additional labels in a way that visibly fails when one is trying to override an existing label.
  3. A way for a new repo to use the above without having to add any GHA.
  4. (Nice to have) a way of migrating from one label to another.
  5. (Nice to have) a way of deleting unused labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request Other
Projects
None yet
Development

No branches or pull requests

7 participants