How to Create a GitHub Workflow
Let’s walk through the steps to set up a simple workflow in your repository:
Step 1: Create a folder where you want to setup GitHub Workflow
Step 2: Create a Workflow File
Inside your project, make a folder .github/workflows/
In that folder, create a file (example: test.yml).
Step 3: Write the Workflow
Use YAML syntax to define what your workflow should do.
Example: A workflow that runs tests every time you push code to the main branch:
name: Run Tests
on:
push:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: echo "Running tests..."
Step 5: Save and commit the changes on GitHub
Step 4: Checking Workflow Output in GitHub
- Go to your repository on GitHub.
- At the top, click on the Actions tab.
- This shows a list of all workflows that have been triggered (e.g., by a push).
- Select the workflow run from the list you want to inspect.
- You’ll see a list of jobs (like test, build, etc.).
- Click on a job, you’ll see the step-by-step logs/output.
What is actions/checkout@v3?
It is a GitHub Action — a reusable piece of code provided by GitHub.
- checkout means "check out the repository" → it downloads (clones) your project’s code into the workflow runner (the temporary server where the workflow runs).
- @v3 means you are using version 3 of this action.
Without actions/checkout, your workflow runner wouldn’t have your project files, so commands like npm install or dotnet build would fail — because there’s no code to build!
Where to get information?
All official and community actions are available on the GitHub Marketplace:
https://github.com/marketplace?type=actions
There, you can search for actions like checkout, setup-node, upload-artifact, etc.
Each action has documentation showing:
- What it does
- Example usage
- Inputs (things you can configure)
- Outputs