Skip to main content
GitHub Actions is GitHub’s built-in automation platform that runs workflows defined in your repository. Workflows are YAML files that describe when the automation should run (triggers) and what steps to execute (jobs and steps). Typical uses include testing, building, and deploying code whenever something changes in your repo. Workflows are event-driven: GitHub fires events (pushes, pull requests, scheduled timers, manual triggers, and many others), and your workflows respond to those events.
This is a screenshot of a GitHub documentation page titled "Events that trigger workflows," detailing how workflows can be configured to run on specific activities within GitHub. There is a menu on the right listing various event types.

Common triggers

  • push — run when commits are pushed to branches or tags.
  • pull_request — run when a pull request is opened, synchronized, or updated.
  • schedule — run at regular intervals using cron syntax.
  • workflow_dispatch — expose a manual run button in the Actions UI.
  • Many repository events (assigned, labeled, opened, etc.) can also trigger workflows.
The image shows a GitHub documentation page describing events that trigger workflows, specifically detailing the "push" event including its payload and activity types. The sidebar displays a list of various event options.
You can combine triggers so a single workflow runs on multiple events. For recurring runs, the schedule trigger uses cron syntax. For manual runs from the repository UI, enable workflow_dispatch:
The image is a screenshot from GitHub Docs showing the "Events that trigger workflows" page, focusing on pull request event payload and activity types such as "assigned," "unassigned," "labeled," etc.

Example: verify a required file on push and PR

This example creates a lightweight workflow that runs on pushes and pull requests targeting the main branch. It performs a simple check: confirm that index.html exists at the repository root. If the file is missing, the job fails. Create a file at .github/workflows/<name>.yml with the following content:
Place this file under .github/workflows/ and commit to the default branch (for example, main). Any push or pull request that targets main will trigger the workflow automatically.
When GitHub Pages is enabled for a repository, GitHub itself runs an internal workflow to build and deploy your site. That same Actions framework is what your custom workflows use — you can see build and deployment jobs, logs, and statuses in the Actions UI.
The image shows a GitHub Actions page displaying the status of a workflow run called "pages build and deployment," which is successful.
You can inspect workflow runs, job decomposition, and logs to troubleshoot or validate behavior. For example, the Pages workflow often runs multiple jobs (build, report status, deploy), which you can expand and view details for.
The image shows a GitHub Actions workflow summary for "pages build and deployment." The workflow has successfully completed with three jobs: "build," "report-build-status," and "deploy."
Once your workflow file is committed to main, the Actions tab will show runs for each push and PR targeting that branch. Click a run to view runner provisioning and logs for each step. Typical checkout-related log lines look like:
The shell step that verifies index.html will echo success or print an error and exit with a non-zero code to fail the job:
The image shows a GitHub Actions page displaying workflow runs for a repository named "block-buster" with workflows such as "Create code-check.yml" and "pages build and deployment".

Quick reference

Learn more

That’s the basic flow: declare triggers, define jobs and steps, use actions (for checkout, caching, etc.), and run scripts or other action steps to validate, build, test, or deploy your code.

Watch Video