Run Your Tests on Every Push
Scenario
You push a booking change. The project has a workflow that runs its test command.
- 1Check out the pushed commit
- 2Set up the runtime and run the project’s test command
- 3Read the resulting status
name: Test booking
on: push
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
- run: node booking.mjsTry it yourself
Follow the pushed commit through the checks.
- Check out the pushed commit
- Set up the runtime and run the project’s test command
- Read the resulting status
Reveal the explanation
- Check out the pushed commit
The runner reads the files associated with that commit.
- Set up the runtime and run the project’s test command
The same booking cases are evaluated in a clean job.
- Read the resulting status
A failed check gives you a run and a log to investigate.
Begin with a test command that works locally. Use the same command in the workflow. A required check needs a separate branch protection setting.
Your turn
Configure a push workflow with the same test command you ran locally. Inspect the first run.
Common mistake Using a CI command that silently skips the local tests.
Check your work
The run identifies the pushed commit and shows the expected cases executing.
This browser could not save your progress. Changes last until you leave the page.