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

Extracting a slice of YML #107

Closed
juanca opened this issue Aug 30, 2024 · 2 comments
Closed

Extracting a slice of YML #107

juanca opened this issue Aug 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@juanca
Copy link

juanca commented Aug 30, 2024

I only recently got into using code_ownership. My workflow seems to be interested in finding out a particular key-value in the Team YML.

Would it be a good idea to add a flag to retrieve a bit of YML?

e.g.

bin/codeownership for_file --get=some.yml.value some/file/here.js
@github-actions github-actions bot added the triage A new issue that needs review by the core team label Aug 30, 2024
@ashleywillard
Copy link
Contributor

Hi @juanca! This isn't an issue that has come up for us. Whenever we've needed specific information about a team, it's been within a ruby script so we'll do something like CodeOwnership.for_file(file_path).attribute. We'd be happy to review a PR for this feature if you want to put one up!

@ashleywillard ashleywillard added enhancement New feature or request and removed triage A new issue that needs review by the core team labels Aug 30, 2024
@juanca
Copy link
Author

juanca commented Oct 3, 2024

My teammate provided us with a good bash solution:

function who-owns() {
    owner=$(bin/codeownership for_file "$1" | head -1 | cut -c7-)
    config=$(rg -l "$owner" config/teams)
    echo Team: $owner
    yq "$config" | yq '.slack'
}

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

No branches or pull requests

3 participants