I just set this up yesterday for a new codebase with GitHub actions. Very straightforward, took an hour or two. Only odd part was that the GitHub actions wizard saves the yaml in the root instead of .github/workflows where it needs to be.
I just set this up yesterday for a new codebase with GitHub actions. Very straightforward, took an hour or two. Only odd part was that the GitHub actions wizard saves the yaml in the root instead of .github/workflows where it needs to be.
Directions vary depending on what you’re doing, but for a React app this will work.
So click on the actions tab in the repo, and click the nodejs template.
Change the run command to the npm script you want to run like npm run ci-check. It will do something along the lines of npm ci && npm run lint-check && npm run format-check && npm run test && npm run build.
Save that. Then move it from the repo root into a new subdirectory you’ll need to create called .github/workflows.
If you are an admin, click the settings tab and protect your merge branch so you can only merge if this succeeds.
That’s it!
It does exactly what you wanted it to. Feel free to email me if you need help setting it up, happy to help. Cheers!
I tested this here: https://github.com/liskin/nodejs-hello-world/pull/1