AI Hints
Home›CI/CD with GitHub Actions Tutorial›Artifacts, Services and Timeouts
CI/CD with GitHub Actions · Lesson 54 of 138

Timeouts and continue-on-error

Keeping runs under control.

⏱ 2 min read▶ Video at 1:01:00🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Two settings keep pipelines under control. A timeout stops a stuck job, before it wastes hours of runner time. And continue on error lets an experimental step fail, without failing the whole job.

Timeouts and continue-on-error
From the video: Timeouts and continue-on-error
  • Stuck jobs waste hours
  • Timeouts stop them
  • Let a step fail safely

Both settings

Timeout minutes, ten, cancels the job if it runs longer than ten minutes. The default is six hours, which is far too long. The experimental check has continue on error, so if it fails, the job carries on to the real tests.

.github/workflows/checks.ymlyaml
name: Checks
on: push
jobs:
  checks:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: Experimental check
        continue-on-error: true
        run: grep -q "TODO" app.py
      - name: Real tests
        run: pytest -q

A failure that is allowed

The experimental check looks for to do notes, finds none, and fails. But the log says the job keeps going. The real tests run and pass, and the job succeeds. Use this carefully, because a step that's allowed to fail is easy to forget about.

Terminal
run-steps .github/workflows/checks.yml
Workflow: Checks  (event: push, branch: main)
Job: checks
  ✗ Experimental check
      Error: Process completed with exit code 1.
      (continue-on-error: the job keeps going)
  ✓ Real tests
      ...                                                                                [100%]
      3 passed in 0.01s
  Job succeeded

Summary

Timeout minutes stops stuck jobs, and continue on error lets a step fail without failing the job. Next, stopping duplicate runs with concurrency.

Key takeaways
  • timeout-minutes
  • continue-on-error
  • Default is 6 hours
Next up: Concurrency — one run at a time