GitHub Actions failures are easier to fix when you debug them in a consistent order. This guide provides a reusable checklist for YAML parsing, triggers, expressions, secrets, permissions, runners, caches, and matrix jobs, plus safe ways to use AI tools to summarize logs without exposing sensitive data.
Overview
A workflow can fail before a job starts, during runner setup, inside a shell command, or only for one combination in a matrix. The visible error is not always the original cause. A reliable debugging process therefore separates configuration problems from environment problems and application-test failures.
Start with the smallest reproducible question: Did GitHub load the workflow, select the expected event, start the intended job, and provide the values that job needs? Check those layers in order rather than changing several YAML blocks at once.
- Syntax and structure: Is the file valid YAML, stored in the workflow directory, and using the expected keys and indentation?
- Event selection: Did the workflow run because of the branch, pull request, tag, path, or manual event you intended?
- Job selection: Did conditions, dependencies, and matrix values allow the job or step to run?
- Runtime inputs: Are the runner, shell, environment variables, secrets, permissions, and checked-out files available?
- Command behavior: Does the application, test suite, package manager, or deployment command work in that environment?
AI-assisted developer tools can help summarize a long log, group repeated errors, or suggest a short list of hypotheses. Treat their output as a debugging aid, not as an authority. Remove secrets, tokens, private URLs, customer data, and proprietary source before sharing logs with any external tool. For related troubleshooting workflows, see this GitHub Actions CI guide for JavaScript, TypeScript, and Python.
Checklist by scenario
When the workflow does not start
- Confirm the workflow file is committed to the expected repository and workflow directory.
- Review the
on:block. Check event names, branch filters, tag filters, path filters, and pull request settings. - Verify that the event actually occurred on a branch or path covered by those filters.
- Check whether a job-level or step-level
if:expression evaluates to false. - For manual runs, confirm the workflow supports the intended dispatch event and that required inputs are supplied.
A useful diagnostic change is to add a temporary, plainly named job with no condition. If that job appears, the issue is more likely in a filter or conditional expression than in workflow discovery.
When YAML or expressions fail
- Inspect indentation, list syntax, quoting, colon usage, and multiline strings.
- Quote values that could be interpreted unexpectedly, especially strings containing special YAML characters.
- Check expression boundaries such as
${{ ... }}and confirm that the referenced context exists at that location. - Use the correct context for the value you need: event payload data, repository information, job results, matrix variables, or step outputs are not interchangeable.
- Break a complicated expression into named environment variables or separate steps so each value can be printed safely.
Do not print an entire context object in a public or shared log. Instead, expose only non-sensitive fields needed to test your assumption. A small diagnostic step is usually more useful than a large dump.
When a secret is unavailable
- Check the secret name character by character and distinguish repository, environment, and organization scope.
- Confirm the job references the environment that contains the secret, if environment-scoped values are being used.
- Consider whether the event is from an untrusted pull request context where protected values may not be made available.
- Verify that the workflow passes the secret through the expected
env:or action input field. - Never use an echo command to test a secret. Test presence through a boolean condition or a command that does not reveal the value.
If a command requires a token, document the expected variable name and fail with a generic message when it is missing. This makes the workflow easier to maintain without leaking credentials.
When permissions cause a failure
- Review the workflow's
permissions:block and identify the exact operation that needs access. - Grant the narrowest permission needed for the job rather than broad access for every job.
- Check whether an action is attempting to create a release, comment, artifact, deployment, or repository change.
- Separate read-only build jobs from write-enabled publishing jobs when practical.
- Recheck permissions after changing the event type, especially when moving from a trusted branch build to a pull request workflow.
When a matrix job behaves differently
- List the matrix dimensions and verify that every combination is valid for the project.
- Use matrix variables explicitly in setup, dependency installation, test, and artifact names.
- Check whether an inclusion or exclusion rule changes the combinations you expected.
- Identify the exact operating system, runtime version, package manager version, or feature flag used by the failing combination.
- Use a job summary or safe diagnostic output to show the active matrix values.
Matrix failures often look inconsistent because one platform or runtime exposes an assumption hidden by the others. Fix the assumption or document the supported combinations instead of retrying the same job blindly.
When dependencies or caches are involved
- Confirm the cache key includes the files that determine dependency resolution, such as a lockfile.
- Check that restore keys are broad enough to provide a useful fallback but not so broad that unrelated dependencies are reused.
- Remember that a successful cache restore does not prove the dependency tree is correct.
- Temporarily disable or bypass the cache to determine whether it is part of the failure.
- Use a new key when testing a suspected stale or incompatible cache.
Keep cache troubleshooting separate from package-manager troubleshooting. First establish whether the job works with a clean install; then optimize repeated runs.
What to double-check
Runner and shell assumptions
Commands that work on one runner may depend on a different shell, preinstalled utility, filesystem path, line-ending behavior, or operating system. Print the runtime and tool versions needed for diagnosis, then make important versions explicit in the workflow. Avoid relying on undocumented software that happens to be present on a hosted runner.
Step outputs and job outputs
Verify that an output is written using the supported output mechanism and that its identifier matches the name referenced later. Check the dependency relationship between jobs before consuming a job output. If an output may contain spaces, newlines, or structured JSON, define its format deliberately and validate it before using it in a shell command.
For JSON-heavy workflows, a focused parser can make failures clearer than string manipulation. The JSON validation and transformation guide and jq command-line recipes provide useful patterns for inspecting structured data.
Logs and AI-assisted analysis
Capture the first meaningful error, the command that produced it, the runner and matrix values, and the relevant preceding lines. Remove masked or sensitive values before using an AI assistant to summarize the log. Ask for a ranked list of hypotheses and a minimal verification step for each one, rather than asking for an unreviewed rewrite of the workflow.
For example, a useful prompt is: “Group these redacted log lines by likely failure layer—YAML, permissions, dependency installation, shell, or test—and give one safe check for each.” Review every suggestion against your repository and workflow design. AI can overlook event trust boundaries, invent unavailable contexts, or recommend excessive permissions.
Use the right adjacent debugging tool
If the action succeeds but an application request fails, inspect the request and response path with a browser DevTools network debugging workflow. For retry and timeout behavior, use the API integration error-handling checklist. Keep CI configuration diagnosis distinct from application logic diagnosis.
Common mistakes
- Changing several things at once: Make one controlled change so the result identifies the cause.
- Assuming a masked value is empty: Logs may hide a secret even when it is present. Test presence without printing content.
- Using broad permissions as a quick fix: Identify the required operation and grant only that access.
- Trusting a green cache restore: A restored cache can still contain incompatible or stale dependencies.
- Ignoring the first error: Later failures may be consequences of an earlier missing file, failed setup step, or invalid variable.
- Copying YAML from an unrelated example: Event filters, contexts, action inputs, and permissions depend on the workflow's purpose.
- Sending raw logs to an AI service: Redact credentials, internal hostnames, tokens, personal data, and proprietary code first.
- Testing only the default branch: Pull requests, tags, scheduled runs, and manual dispatches can have different inputs and trust boundaries.
When to revisit
Revisit this checklist whenever a workflow, action, runner image, runtime, package manager, permission model, or repository event changes. It is especially useful before a release cycle, after adding a matrix dimension, when rotating secrets, when a dependency cache begins behaving strangely, or when moving build and deployment steps between jobs.
After fixing a failure, record the cause in the workflow or repository documentation: the triggering event, affected job, relevant context, safe diagnostic command, and permanent fix. Remove temporary debug output and restore restrictive permissions before merging.
For the next failure, follow this short sequence:
- Copy the first actionable error and note the job, step, event, runner, and matrix values.
- Classify it as syntax, trigger, condition, permission, secret, environment, cache, dependency, or application behavior.
- Make one safe diagnostic change.
- Use redacted logs or a local reproduction to test the leading hypothesis.
- Apply the smallest durable fix, then run the workflow across the combinations that matter.
- Document the lesson and remove temporary diagnostics.
Consistent diagnosis turns GitHub Actions debugging from trial and error into a repeatable developer productivity workflow—one that remains useful as your repository and CI configuration evolve.