How can I fix GitHub Actions timing out on long-running workflows?
This issue usually happens due to GitHub's default timeouts. Increase the timeout in the YAML file or break the workflow into smaller jobs.
When GitHub Actions time out on long-running workflows, it's generally due to GitHub’s default workflow timeout setting, which is 6 hours for workflows on GitHub-hosted runners. To extend the timeout, open your YAML workflow file in the .github/workflows/
directory and add the timeout-minutes
property under the jobs
section, setting it to a higher value like timeout-minutes: 360
for 6 hours. If your workflow requires an even longer duration, consider breaking it into smaller jobs that run sequentially or independently, thereby minimizing the time each job runs. For resource-heavy jobs, try optimizing steps to reduce unnecessary processing. Consider caching dependencies or performing lengthy operations outside GitHub Actions if feasible. Breaking down and optimizing workflows reduces the chance of timeout, improving efficiency in CI/CD operations.