Software⏱️ 2 min read📅 2026-05-31

How to Fix: Set default Timeout on Github action pipeline

Set default timeout limit on GitHub Action pipeline to auto-cancel after 30 minutes.

Quick Answer: Use the `timeout` action in your YAML file, e.g. `steps: - name: Checkout code uses: actions/checkout@v2 - name: Run script run: timeout 30m bash -c 'your_command_here'

Normally, my pipelines take 15 minutes to execute.

Recently, for some strange reasons, some pipelines take between 45 minutes and 6 hours to fail.

Is it possible to set a default timeout limit on GitHub Action's pipeline (for example, auto cancel after 30 minutes)?

🛑 Set Default Timeout on Github Action Pipeline

  • Yes, it is possible to set a default timeout limit on GitHub Actions pipelines.

🚀 How to Set Default Timeout

Method 1: Using the `timeout` environment variable

  1. Step 1: In your GitHub Actions workflow file, add an environment variable for timeout.

Example:

name: My Workflow
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run script
run: timeout 30m /bin/bash -c 'your script here'

✨ Wrapping Up

By setting a default timeout limit, you can prevent your pipelines from running indefinitely and reduce the risk of unexpected failures.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions