ts-strictify
ts-strictify copied to clipboard
Add note of how to run this inside a CI
I configured my Github Actions pull_request job to run ts-strictify.
The actions/checkout@v2 by default does not fetch all repository refs, so master is not available, leading to this issue:
fatal: ambiguous argument 'master...': unknown revision or path not in the working tree.
I fixed it by using fetch-depth: 0 (will fetch the master branch) and setting the flag targetBranch origin/master.
I think it would be nice to add a note on readme saying that the environment needs to have valid git refs present (which CodePipeline, for instance, does not provide by default) and that pointing to origin/master leads to better results.
If anyone else comes across the same issue:
For some reason it didn't work as an npm script, but moving it directly to the workflow did the trick:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
...
- name: Strictify
run: npx ts-strictify --targetBranch=origin/master