Quick answer

Add a simple automated check to a repository and interpret its results before merging. A CI workflow checks code when a pull request changes. This tutorial uses a harmless Node.js syntax check; it does not prove that your software is bug-free.

A CI workflow checks code when a pull request changes. This tutorial uses a harmless Node.js syntax check; it does not prove that your software is bug-free.

Before you begin

You need a GitHub repository with a small JavaScript file, repository permission to commit and GitHub Actions enabled. Never place tokens directly in YAML.

Method guide · not a product benchmark

01Create a tiny baseline

Add an app.js file with a valid console.log statement. Run node --check app.js locally first if Node.js is installed. Keep this teaching repository separate from production customer code. Keep the file deliberately small: for example, console.log('CI example ready'). Save it at the repository root, run node --check app.js and commit the known-good version. A first check should have one clear purpose; adding linting, tests and deployment steps simultaneously makes failures harder to isolate.

02Write the workflow file

Create .github/workflows/check.yml in a branch. Give it a descriptive name, trigger on pull_request and use ubuntu-latest, actions/checkout@v4 and actions/setup-node@v4. Run node --check app.js; use read-only default permissions. Here is the minimal job structure to type into the YAML file: name: Check; on: [pull_request]; permissions: {contents: read}; jobs: {syntax: {runs-on: ubuntu-latest, steps: [{uses: actions/checkout@v4}, {uses: actions/setup-node@v4, with: {node-version: '24'}}, {run: 'node --check app.js'}]}}. In a real YAML file, indent each nested field correctly. Pin action versions or commit hashes according to your security policy.

03Trigger checks on pull requests

Open a pull request from your branch into main. GitHub starts the check when the workflow exists and Actions are enabled. Look under the Checks tab and verify the run corresponds to the right commit. Check the Actions tab as well as the pull request checks. Confirm the event is pull_request and that the workflow ran on the commit you intended to review. If the workflow does not start, inspect repository Actions permissions, the workflow file path and whether the event matches your branch activity.

04Understand failure logs

Introduce a deliberate syntax error in the branch and rerun the check. Open the failed job logs to identify the command and error line, then repair the file. Do not publish a failing experiment to main. For the negative test, delete a closing quote in the branch's console.log and push that commit. Expect the syntax command to fail, but do not invent the exact error text: open the job log and record what Node reports. Repair the quote, push again and inspect the new run before merging.

05Make merging safer

Require passing checks under your repository branch protection or ruleset, if available. Remember that syntax checks do not test product correctness, accessibility, security or factual claims; keep review appropriate to risk. An appropriate merge rule depends on your repository settings and plan: select the exact required check after it has run successfully at least once. A green syntax job means only that Node parsed the file. Add real unit tests and human review if the code affects customer data or billing.

Try this prompt

Review this GitHub Actions YAML for minimal permissions, reliable Node installation and useful failure reporting. Explain risks without claiming to run it: [paste YAML].

Worked example

Fictional teaching example — not a product test or a real customer record.

Starting information

Fictional learning example; no live customer data or measured product outputs.

Expected result

Expected: complete the steps, keep evidence, and verify the real interface before acting.

Before you use the result

  • Confirm the exact software version and access rights.
  • Keep secrets and private records out of demonstrations.
  • Do not treat this hypothetical result as a real test.

Worksheet

Editable text file. Fill it with your own evidence; blank fields are not results.

Download the worksheet (.txt)

Further reading

Back to the library