DevOpsil
CI/CDMedium

Fix: GitHub Actions Process Completed with Exit Code 1

GitHub Actions workflow fails with 'Process completed with exit code 1'

!Symptoms

  • GitHub Actions workflow fails with 'Process completed with exit code 1'
  • Red X on the PR check without a clear error message
  • Build step passes but test or lint step fails

?Root Causes

  • Test failures in the test suite
  • Linting errors (ESLint, Pylint, etc.)
  • Build compilation errors
  • Missing environment variables or secrets in the workflow
  • Dependency installation failure (npm, pip, etc.)
  • Script returning non-zero exit code

#Diagnosis Steps

  1. 1Expand the failed step in the GitHub Actions log to see the full output
  2. 2Look for the actual error message above the 'exit code 1' line
  3. 3Check if secrets/env vars are available: they are empty in forks and for first-time contributors
  4. 4Run the same commands locally to reproduce the error
  5. 5Check if the failure is intermittent (re-run the workflow)

>Fix

  1. 1Fix the underlying error shown in the step output (test failure, lint error, etc.)
  2. 2Add missing secrets to the repository settings (Settings > Secrets > Actions)
  3. 3Pin dependency versions to avoid unexpected breaking changes
  4. 4Add `continue-on-error: true` to non-critical steps if appropriate
  5. 5For flaky tests, add retry logic: `uses: nick-fields/retry@v2`

*Prevention

  • Run tests and linting locally before pushing (use pre-commit hooks)
  • Use `act` tool to run GitHub Actions locally for debugging
  • Pin all action versions to specific SHAs or tags
  • Set up required status checks so failures are caught before merge
  • Add timeout-minutes to prevent jobs from hanging indefinitely

Related Error Messages

Process completed with exit code 1Error: Process completed with exit code 2The process '/usr/bin/git' failed with exit code 128npm ERR! code ELIFECYCLEError: Resource not accessible by integration