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

automate adding Container labels #93

Open
kranurag7 opened this issue Mar 1, 2024 · 4 comments · May be fixed by #94
Open

automate adding Container labels #93

kranurag7 opened this issue Mar 1, 2024 · 4 comments · May be fixed by #94
Labels
Container Issues or pull requests relevant for Team 2: Container Infra and Tooling

Comments

@kranurag7
Copy link
Contributor

From what I understand, I think we need Container label on this repo, CSPO and csctl.

pull request

I think we can automate it for pull requests using actions/labeler and for renovate PRs, we can use renovate itself.

issues

For issues, I think we can use the following:
https://docs.github.com/en/actions/managing-issues-and-pull-requests/adding-labels-to-issues#creating-the-workflow

This runs on every issue open and reopen which might be too much to we will never notice it, Given it runs in ground. If it sounds too much then we can use a cron workflow for the same.

/kind feature

// cc @janiskemper @jschoone

@kranurag7 kranurag7 added the Container Issues or pull requests relevant for Team 2: Container Infra and Tooling label Mar 1, 2024
@kranurag7 kranurag7 linked a pull request Mar 1, 2024 that will close this issue
3 tasks
@jschoone
Copy link
Contributor

jschoone commented Mar 1, 2024

Hi @kranurag7, thank you for this idea and implementation!

You are right, the issues in those repos must be labeled with Container.
Let me explain why: The only reason is the GitHub Projects board. This tracks the whole organization (and even external repos), which obviously would be a mess if not filtered. For this filtering we use the different labels for the teams (Container, IaaS, IAM and Ops) to create the views.
Since all Cluster Stack related repos (as of today CSO, CSPO and csctl) are Container related per se I could also just filter by repo:, then we could avoid having the label there.
To also show Container related issues from other (org wide) repositories we need a way to get them and this is the label.
The annoying thing now it that GitHub Projects does not currently support logical OR filters across multiple fields. Means I can't to "Give me that full repo and from the other repo only issues labeled with XYZ".
And this is actually the reason why we use the label everywhere 🙈

In fact, this should be done for every issue:

and this for every PR:

  • add label Container
  • add to Project "Sovereign Cloud Stack" ONLY if there is no linked issue (I used -linked:issue for this in the GH search syntax)

As you are already on it, could you have a look how to realize the other cases as well?

@kranurag7
Copy link
Contributor Author

Thank you for clearing the scope.

Please check the commit here 727144a

I was not able to find a way to automate this.
add to Project "Sovereign Cloud Stack" ONLY if there is no linked issue (I used -linked:issue for this in the GH search syntax)

I tried getting linked request using gh but there is not nice way to get it using gh pr view command not even if I use --json flag.

I attempted to get it by directly invoking the API using the following command.

$ gh api /repos/SovereignCloudStack/cluster-stack-operator/pulls/94 --jq '._links.issue'
{
  "href": "https://api.github.com/repos/SovereignCloudStack/cluster-stack-operator/issues/94"
}

But this is not correct URL.

I was not able to complete the last part where we filter the PR using -linked:issue

For the moment, the latest commit fixes the first three sections. For adding issues to project board, we will need to add a token in settings/actions

https://github.com/actions/add-to-project/?tab=readme-ov-file#creating-a-pat-and-adding-it-to-your-repository

@jschoone
Copy link
Contributor

jschoone commented Mar 1, 2024

No worries, it's not urgent. We never used the automation before so it's still a pretty good enhancement, thank you!

The ADD_TO_PROJECT_PAT should now be available

@kranurag7
Copy link
Contributor Author

Thanks for adding the token and the fix in the project URL.

After review this will get merged and after tracking it for a day or two, I'll propagate the same in cspo and csctl repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Container Issues or pull requests relevant for Team 2: Container Infra and Tooling
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

2 participants