asyncapi / .github

Location of all reusable community health files
29 stars 62 forks source link

fix: add `.prettierignore` to disable auto-formatting issue across all repositories #253

Closed AnimeshKumar923 closed 4 months ago

AnimeshKumar923 commented 11 months ago

Description

@derberg

cc: @akshatnema @fmvilas @vishvamsinh28

Related issue(s) Fixes #252

akshatnema commented 11 months ago

@AnimeshKumar923 @derberg Do we have to update any workflow file as well to include this file in updating global workflows?

AnimeshKumar923 commented 11 months ago

Do we have to update any workflow file as well to include this file in updating global workflows?

@akshatnema I'm still not so sure about that as I don't understand much where to update the workflows. Will look into it. But it would be better to let @derberg take a look at it and inform about it.

AnimeshKumar923 commented 11 months ago

and I think we should not push to all by default, but probably agree on some github repo topic name that repo maintainer can add to get this file, maybe thinking

@derberg One suggestion from my side is that we announce it on the contributing channel and ask where to add this file. Can we do this?

AnimeshKumar923 commented 11 months ago

the way it is done now means that this file is just for this repo

to have it replicated, you need to add a new job to https://github.com/asyncapi/.github/blob/master/.github/workflows/global-replicator.yml

something like this one: https://github.com/asyncapi/.github/blob/master/.github/workflows/global-replicator.yml#L91-L107

Hmmm...I'll have to look into that as I'm unfamiliar with YAML files and workflows stuff, but got some experience while working with this: https://github.com/asyncapi/community/pull/805 so give me some time to figure this out... @derberg and I'm proud (a little bit) of myself to have my first major contribution here. :blush:

derberg commented 11 months ago

maybe there is a way to use GitHub Search to check in in asyncapi org there is any repo that uses prettier

AnimeshKumar923 commented 11 months ago

and I think we should not push to all by default, but probably agree on some github repo topic name that repo maintainer can add to get this file, maybe thinking

@derberg One suggestion from my side is that we announce it on the contributing channel and ask where to add this file. Can we do this?

adding to this, maybe we can start a discussion on this topic on GitHub and let the maintainer join in and discuss. If required, I can open a PR in every repo that requires the prettierignore file and referencing this original issue from here? What do you say? @derberg

derberg commented 11 months ago

first we should clarify what repo requires it

there are 2 ways:

this is what we need to put up for discussion

vishvamsinh28 commented 11 months ago

first we should clarify what repo requires it

there are 2 ways:

  • add prettierignore everywhere, excluding repos where prettier is used
  • add prettierignore only to repos that need it

this is what we need to put up for discussion

I think we should go with 2nd option

derberg commented 11 months ago

and this is the easiest and least aggressive way definitely

akshatnema commented 11 months ago

@derberg Can we define the list of repositories in the workflow file to specify in which repos we want to replicate this file?

AnimeshKumar923 commented 11 months ago

first we should clarify what repo requires it

there are 2 ways:

* add prettierignore everywhere, excluding repos where prettier is used

* add prettierignore only to repos that need it

this is what we need to put up for discussion

I would go with the 2nd option and ask where to add the prettierignore file, which repos require it. Then create a parent issue containing all the places where it is required and move forward with adding through a PR.

chinma-yyy commented 11 months ago

What if we add a condition on the file replicator workflow to check if the repository has any prettier config file? We must check if the repo has a .prettierrc.* file. If yes then don't add the file to the repo

derberg commented 11 months ago

Can we define the list of repositories in the workflow file to specify in which repos we want to replicate this file?

we can provide a list of repos, but we also can specify a github topic that one can add to repo, easier than opening a PR to add new repo to the list. Have a look at https://github.com/asyncapi/generator and get-global-releaserc topic, which means that this repo gets always the latest file whenever it is updated in .github repo. We can have another one, get-global-prettierignore and tell people: hey, add this topic to repo, in a week from now we will add it to.githuband then you will get it

AnimeshKumar923 commented 11 months ago

maybe there is a way to use GitHub Search to check in in asyncapi org there is any repo that uses prettier

Will look into this...

AnimeshKumar923 commented 11 months ago

Have a look at https://github.com/asyncapi/generator and get-global-releaserc topic, which means that this repo gets always the latest file whenever it is updated in .github repo. We can have another one, get-global-prettierignore and tell people: hey, add this topic to repo, in a week from now we will add it to.githuband then you will get it

Hey @derberg can you tell me more about how the topic integrate with providing updates. Any blog/articles on it?

derberg commented 11 months ago

@AnimeshKumar923 no blog/article, it is our custom solution.

Imagine we push dedicated new configuration for prettier, so it works this way:

AnimeshKumar923 commented 11 months ago

@AnimeshKumar923 no blog/article, it is our custom solution.

* we use https://github.com/derberg/manage-files-in-multiple-repositories to replicate files in multiple repos

* one of features is to push files only to repos that have specific topic (more about [gh topics](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/classifying-your-repository-with-topics))

Imagine we push dedicated new configuration for prettier, so it works this way:

* repo maintainer adds required topic to a repo

* repo maintainer asks `.github` repo maintainers to trigger global workflow replication:

* bot updates whatever is needed to update

Let me research about it. Will report you later...

derberg commented 11 months ago

but what part you want to research? someone just needs to ask community in slack, in tooling channel, who wants to get this ignoreprettier file, we give people a week to say they want it and that is it

vishvamsinh28 commented 11 months ago

but what part you want to research? someone just needs to ask community in slack, in tooling channel, who wants to get this ignoreprettier file, we give people a week to say they want it and that is it

I'll ask them

AnimeshKumar923 commented 11 months ago

but what part you want to research?

@derberg By research I mean to have a look at the custom method you mentioned. I'll study about it a bit because this is new to me. I'm having some college work lately, so getting less time to devote here. Sorry about that, but will do the needful from my side.

someone just needs to ask community in slack, in tooling channel, who wants to get this ignoreprettier file, we give people a week to say they want it and that is it.

Hmm...okay. I guess @vishvamsinh28 already did ask it here

akshatnema commented 11 months ago

we can provide a list of repos, but we also can specify a github topic that one can add to repo, easier than opening a PR to add new repo to the list. Have a look at https://github.com/asyncapi/generator and get-global-releaserc topic, which means that this repo gets always the latest file whenever it is updated in .github repo. We can have another one, get-global-prettierignore and tell people: hey, add this topic to repo, in a week from now we will add it to .github and then you will get it

@derberg I'm good with this approach. We just have to ask the maintainers of all repos to add the tag in their repo, if they want this file to be added.

derberg commented 4 months ago

@AnimeshKumar923 do you plan to continue with this one?

AnimeshKumar923 commented 4 months ago

@AnimeshKumar923 do you plan to continue with this one?

Hey @derberg :wave: Thanks for reminding! This one slipped from my mind :sweat_smile: Give me few days and I'll let you know about it. It's been a while since I looked at this so need a bit of time to grasp this again...

AnimeshKumar923 commented 4 months ago

/au

AnimeshKumar923 commented 4 months ago

Hi @Shurtu-gal :wave:

Need your help in reviewing this. Can you please take a look at it and provide feedback? Thank you!

AnimeshKumar923 commented 4 months ago

@AnimeshKumar923 I couldn't see any .prettierignore file which needs to be replicated.

You should add one like in https://github.com/asyncapi/.github/blob/master/.github/workflows/.releaserc

Added the file, please review it once again... @Shurtu-gal

Shurtu-gal commented 4 months ago

Looks fine to me @AnimeshKumar923, but as I am not the CODEOWNER it would be better to ask for approval of others too.

AnimeshKumar923 commented 4 months ago

Looks fine to me @AnimeshKumar923, but as I am not the CODEOWNER it would be better to ask for approval of others too.

Thank you so much for the help! Appreciate it. @Shurtu-gal

Bringing your kind attention to this @derberg

AnimeshKumar923 commented 4 months ago

please update readme with new topic name

@derberg Did the required change through f5ad226 Please have a look.

NOTE: The URL at L18 of README is currently pointing to my personal fork of this repo. Once this PR is merged, I will update the URL accordingly.

derberg commented 4 months ago

/rtm

derberg commented 4 months ago

/rtm

AnimeshKumar923 commented 3 months ago

Thanks!

Would be great if after merging this PR you could drop a message in tooling channel, for maintainers that they can use new topic to get the global prettier to protect from PRs that apply auto formatting

Yes, will do for sure! 👍