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

Is it possible to put .all-contributorsrc in subfolders? #328

Open
laike9m opened this issue Oct 30, 2020 · 9 comments
Open

Is it possible to put .all-contributorsrc in subfolders? #328

laike9m opened this issue Oct 30, 2020 · 9 comments

Comments

@laike9m
Copy link

laike9m commented Oct 30, 2020

Is your feature request related to a problem? Please describe.
Right now it seems the .all-contributorsrc file can only be placed in the root folder. I would like to put it in the .github folder, is it possible?

Describe the solution you'd like
Not sure, but I feel we can relax the restriction by including .github as a valid location.

Describe alternatives you've considered
N/A

Additional context
N/A

@laike9m laike9m changed the title Is it possible to put .all-contributorsrc in subfolders? Is it possible to put .all-contributorsrc in subfolders? Oct 30, 2020
@Berkmann18
Copy link
Member

You make a good point, yeah, that feature would be useful. PR welcome.

@laike9m
Copy link
Author

laike9m commented Oct 31, 2020

Is it possible to provide some guide, like, pointers to the code that reads the config file? It would be helpful for whoever wants to work on this feature, it could be me or someone else.

@Berkmann18
Copy link
Member

@laike9m
Copy link
Author

laike9m commented Oct 31, 2020

Thanks. I plan to work on bot -> cli -> documentation, because I use bot the most.

For implementation details, I'm thinking of the most straightforward way by adding a try-catch around the getFile call

https://github.com/all-contributors/all-contributors-bot/blob/97c0eea38164ce9e7a705e120af85124dc0a5c14/src/tasks/processIssueComment/OptionsConfig/index.js#L36-L39

So it would become something like:

let content: rawOptionsFileContent;
let sha;
try {
    ({content, sha} = await this.repository.getFile(ALL_CONTRIBUTORS_RC));
} catch (error) {
    if (error instanceof ResourceNotFoundError) {
        ({content, sha} = await this.repository.getFile(".github/" + ALL_CONTRIBUTORS_RC));
    }
}

This way, no other code is affected, most of the time there's no overhead. And if users put the config file under .github/, at most there's one extra API call.

What do you think?

@Berkmann18
Copy link
Member

Thanks. I plan to work on bot -> cli -> documentation, because I use bot the most.

It may be wiser to try doing that for the CLI first. Why? Because the bot relies on it (to an extent).

Your implementation idea looks good to me.

@laike9m
Copy link
Author

laike9m commented Nov 1, 2020

It may be wiser to try doing that for the CLI first.

Sure if that's the case. May I ask how the bot is relying on the CLI?

@Berkmann18
Copy link
Member

./src/tasks/processIssueComment/OptionsConfig/index.js and ./src/tasks/processIssueComment/ContentFiles/index.js depends on it.

@GaryHilares
Copy link

Hello. I wanted to know if a solution was finally found for this. I'm using All Contributors in my project but I don't want to have .all-contributorsrc in my root folder.

@laike9m
Copy link
Author

laike9m commented Apr 2, 2021

@GaryNLOL No, I have not worked on it. Feel free to take over if you want to.

@tenshiAMD tenshiAMD transferred this issue from all-contributors/all-contributors Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants