Now that the number of contributors is growing, I'd like to introduce prettier for code formatting
Here is the syntax I usually use. I don't want us to customize prettier rules. That way people can get mad at prettier and not us if they don't like any of the formatting 🤣
https://github.com/gr2m/github-app-slack-demo/blob/47fc915ff72c7b0a3e4f9b26761c18c303cd5152/package.json#L15
I don't want to add it to our CI and bother our contributors. Instead, we can silently fix formatting directly in the main branch using a dedicated app later. I'll take care of that once this issue is resolved. But in a nutshell
- Register a single purpose GitHub app with
contents:write permission, webhooks disabled.
- Install the app on this repository
- Add the App ID as variable and private key as secret to this repository
- Create a new workflow that is triggered by push to
main
- Use https://github.com/actions/create-github-app-token to create an installation access token
- Use that token to check out the repository
- run the
lint:fix npm script
- Commit the changes (if any) with
style: prettier and push them
- Using repository rules, add the registered github app to the allowed actors that can bypass branch protections
- Profit 🎉
Here is a format.yml workflow for reference:
https://github.com/gr2m/github-app-slack-demo/blob/47fc915ff72c7b0a3e4f9b26761c18c303cd5152/.github/workflows/format.yml
Now that the number of contributors is growing, I'd like to introduce
prettierfor code formattingHere is the syntax I usually use. I don't want us to customize prettier rules. That way people can get mad at prettier and not us if they don't like any of the formatting 🤣
https://github.com/gr2m/github-app-slack-demo/blob/47fc915ff72c7b0a3e4f9b26761c18c303cd5152/package.json#L15
I don't want to add it to our CI and bother our contributors. Instead, we can silently fix formatting directly in the main branch using a dedicated app later. I'll take care of that once this issue is resolved. But in a nutshell
contents:writepermission, webhooks disabled.mainlint:fixnpm scriptstyle: prettierand push themHere is a
format.ymlworkflow for reference:https://github.com/gr2m/github-app-slack-demo/blob/47fc915ff72c7b0a3e4f9b26761c18c303cd5152/.github/workflows/format.yml