This repository is a Demo that shows how to use Betterer Github Action in a way that improves Developer Experience. This means that you no longer need to run Betterer before commit.
- Commit new typescript changes
- CI/CD github action uses
Betterer Github Action
to run Betterer that compiles TypeScript with stricter settings - If there are changes detected during compilation by Betterer (that means - fixed or new TS offences), custom reporter:
- prints summary of those changes
- prints information about the whole initiative of improving TS practices
- prints information about ways to proceed right now, that is:
- ✅ Fix the issues: Developer can fix new issues he has added right now;
⚠️ Update results file: Or, Developer can accept new offences as something we can live with right now, by adding comment withbetterer:update
text into Pull Request. This comment will trigger following events:- new CI job is triggered
- that CI job runs Betterer with
--update
flag - which generates new
betterer.results
file that contains current state of TS offences - commits this file to current branch
- sends PR comment that gives nice summary of changes (amout of fixed/added issues)
- Create new branch in repository of your project
- Run
yarn add @betterer/cli@5.1.5 --dev
in your project directory - Run
yarn add @betterer/typescript@5.1.5 --dev
in your project directory - Copy
.betterer.results
file to repository/directory of your project - Copy
.betterer.ts
file to repository of your project - Search for
<--- Adapt to your project needs
text in it and update those places to your project needs - Copy
.github/workflows/betterer--your-project-name.yml
file to repository/directory of your project - Rename file name to use your project name in it
- Search for
<--- Adapt to your project needs
text in it and update those places to your project needs - Copy
.github/workflows/betterer-chatops--your-project-name.yml
file to repository/directory of your project - Rename file name to use your project name in it
- Search for
<--- Adapt to your project needs
text in it and update those places to your project needs - Copy
.betterer.results
file to repository/directory of your project - Merge those changes to master/main branch (only then all Github Actions will work)
- Create new branch in repository of your project
- Edit any TS or TSX file
- Commit this change
- Create PR out of this branch
- Wait for Betterer CI job to fail
- Add comment into this PR with text
yourprojectname:betterer:update
(in this demo the command isplatform:betterer:update
) - Wait for BOT message in PR that shows that
.betterer.results
file was updated - Thats it :)