actions / actions/runner

`./config.sh --check ...` should return a non-zero exit code if any check fails.

Open Beginner friendly
#4,395 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Describe the bug

Running ./config.sh --check --url ... --pat ... always exits with a status code of 0, which on linux indicates success. This is the case even when one or more of the checks fail.

The lack of an accurate exit code makes ./config --check useless as a docker HEALTHCHECK method without grepping the text output for F A I L (because the presentation seems to matter more than the information, I guess.)

To Reproduce

  1. Follow the published instructions to set up the runner app and generate a PAT.
  2. Per the published docs, run ./config.sh --check --url https://github.com/your/org-or-repo --pat ghp_1234abcd with the appropriate values replaced.
  3. Run echo $?
  4. The output will always be 0, even when one or more of the checks fails.

Expected behavior

If the STDOUT console output from the --check command contains F A I L anywhere, then the exit code should be non-zero.

Runner Version and Platform

Version of your runner?
v2.334.0

OS of the machine running the runner?

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.4 LTS"

What's not working?

What should happen?

  • The ReturnCode class should be updated to include a new error state code (if appropriate).
    public const int CheckFailure = 8; for example.
  • The if (command.Check) branch should define an exitCode variable and initialize it to Success.
    var exitCode = Constants.Runner.ReturnCode.Success;
  • In the case of if (!result) for any given check, change the value of exitCode to CheckFailure (or whatever the new constant is named).
    exitCode = Constants.Runner.ReturnCode.CheckFailure;
  • The entire branch should exit with the value of exitCode, instead of hard-coded "Success".
    return exitCode;

Job Log Output

% ./config.sh --check --url $GITHUB_ORG_URL --pat $GITHUB_PAT

*********************************************************************************************
**  Check:               Internet Connection
**  Description:         Check if the Actions runner has internet access.
*********************************************************************************************
**                                                                                         **
**                                            F A I L                                      **
**                                                                                         **
*********************************************************************************************
** Log: /github/actions-runner/_diag/InternetCheck_20260430-171324-utc.log
** Help Doc: https://github.com/actions/runner/blob/main/docs/checks/internet.md
********************************************************************************************


********************************************************************************************
**  Check:               GitHub Actions Connection
**  Description:         Check if the Actions runner has access to the GitHub Actions service.
********************************************************************************************
**                                                                                        **
**                                            F A I L                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/ActionsCheck_20260430-171324-utc.log
** Help Doc: https://github.com/actions/runner/blob/main/docs/checks/actions.md
********************************************************************************************


********************************************************************************************
**  Check:               Git Certificate/Proxy Validation
**  Description:         Check if the Git CLI can access GitHub.com or GitHub Enterprise Server.
********************************************************************************************
**                                                                                        **
**                                            P A S S                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/GitCheck_20260430-171324-utc.log
********************************************************************************************


********************************************************************************************
**  Check:               Node.js Certificate/Proxy Validation
**  Description:         Check if Node.js has access to GitHub.com or GitHub Enterprise Server.
********************************************************************************************
**                                                                                        **
**                                            P A S S                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/NodeJsCheck_20260430-171324-utc.log
********************************************************************************************


% echo $?
0

👆 Don't blame me for the formatting of this output, this is how the code is written.

Runner and Worker's Diagnostic Logs

The underlying cause of my personal --check failure isn't important to this issue, so the _diag logs aren't helpful.

But for the sake of completeness and reproducibility-- in my case, the host ubuntu server that was running the actions runner binary did not have the command line ping utility installed, causing the Internet Connection and GitHub Actions Connection tests to fail as seen above.

This itself might be a false-positive failure, since the ability to ping a tcp/ip host probably isn't strictly required for the runner to operate correctly as long as DNS resolution is working and HTTPS requests are permitted. 🤷‍♂️

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Runner.Listener/Runner.cs at ExecuteCommand and its Check branch, then inspect the ReturnCode definitions in src/Runner.Common/Constants.cs. Run ./config.sh --check with a deliberately failing check and verify that the command returns non-zero while successful checks still return zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions, shell
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.