GitHub Actions

GitHub Actions Core Concepts

Cancelling and Skipping Workflows

Optimize your continuous integration (CI) pipeline by learning how to prevent unnecessary GitHub Actions runs and how to stop jobs that are already in progress. This guide covers:

  • How to skip workflows using commit-message directives
  • How to cancel an in-progress workflow from the GitHub UI

Skipping Workflow Runs via Commit Messages

By including specific keywords in your commit messages, you can tell GitHub Actions to bypass workflow triggers for push and pull_request events. This is particularly useful when making non-code changes like documentation updates.

Note

The directives below are case-insensitive and must appear anywhere in your commit message.

DirectiveBehavior
skip ciSkip all workflow runs for this commit
ci skipAlias for skip ci
no ciSkip all workflow runs for this commit
skip-checks: trueAdd after two blank lines at end of commit message

The image shows a GitHub documentation page about skipping workflow runs, explaining how to prevent workflows from triggering by using specific commands in commit messages.

Warning

Skipping CI can hide build failures. Use these directives only for trivial changes (e.g., spelling fixes, docs).


Example: Skipping Workflows for Documentation Changes

When you update files like README.md, you often don’t need to rebuild or redeploy your application. Here’s how to skip CI for pure documentation commits:

The image shows a Visual Studio Code interface with a README.md file open, displaying text about exploring GitHub Actions. The file explorer on the left lists several YAML and script files.

  1. Edit your documentation file:
    git add README.md
    git commit -m "Refresh markdown formatting [ci skip]"
    
  2. Push the commit:
    git push origin main
    
  3. Confirm no workflows ran by checking the Actions tab in your repository.

Cancelling an In-Progress Workflow

If you realize a running workflow is no longer needed—perhaps it was triggered by mistake or contains a broken job—you can cancel it in just a few clicks:

  1. Go to the Actions tab in your GitHub repository.
  2. Click the workflow run that’s currently in progress.
  3. Hit Cancel workflow in the upper-right corner of the run details page.

Your job will be immediately terminated, freeing up your runner capacity.


Watch Video

Watch video content

Practice Lab

Practice lab

Previous
Workflow Event Filters and Activity Types