🧭 GOAL:
Set up a CI workflow in your repo (e.g., for testing), so it shows up as a status check you can enable under Branch Protection Rules.
✅ STEP-BY-STEP PROCEDURE
🔹 Step 1: Open your project in your code editor (or GitHub)
Navigate to the root of your repo
Create a new folder:
bash
.github/workflows/
The leading . makes this a hidden folder — this is where all GitHub Actions go.
🔹 Step 2: Create a workflow YAML file
Inside the workflows folder, create a file named (for example):
Kopiëren
ci.yml
Then paste the following (customize to your tech stack):
🧪 Node.js / JavaScript Example:
yaml
name: CI
on:
push:
branches: [backend, acceptance, main]
pull_request:
branches: [backend, acceptance, main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test
🔄 Replace npm run test with the command that runs your actual tests.
🔹 Step 3: Commit and push the workflow file
bash
git add .github/workflows/ci.yml
git commit -m "Add CI workflow for status checks"
git push origin your-branch-name
🔹 Step 4: Create a Pull Request (optional, but good)
Go to GitHub → Create a PR from that branch
GitHub Actions will now run the workflow automatically
You'll see a status check like ✅ CI / test under the PR
🔹 Step 5: Set Up Branch Protection Rules
Go to your GitHub repo → Settings
Click Branches → Add/Edit a rule for main, acceptance, or backend
Enable these:
✅ “Require status checks to pass before merging”
✅ “Require branches to be up to date”
Under "Status checks that are required", choose:
CI / test (or whatever the name of your job is)
If you don’t see it yet — run the workflow once via PR or push first.
✅ Final Result:
Now, your repo will block merges into protected branches unless all tests pass.