Skip to content

hack/ci: exit instead of return on missing github credentials - #29531

Open
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:hack-ci-pr-tests-exit
Open

hack/ci: exit instead of return on missing github credentials#29531
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:hack-ci-pr-tests-exit

Conversation

@ROKUMATE

Copy link
Copy Markdown
Contributor

pr-should-include-tests is executed, not sourced, so the return 1 used when GITHUB_TOKEN or GITHUB_REPOSITORY is unset does not stop the script. bash prints return: can only return from a function or sourced script and execution falls through to the curl call with empty credentials, ultimately failing with the misleading PR does not include tests message instead of the intended cannot query github error.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • I have read and understood our contributing guidelines and will not have more than two open PRs as a new contributor.
  • PR description, commit message, and GitHub comments are human-written, per LLM Policy
  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

None

@github-actions github-actions Bot added the CI label Aug 15, 2026
@ROKUMATE
ROKUMATE force-pushed the hack-ci-pr-tests-exit branch from e2f8312 to a526920 Compare August 17, 2026 11:04
Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
@ROKUMATE
ROKUMATE force-pushed the hack-ci-pr-tests-exit branch from a526920 to 4637153 Compare August 17, 2026 11:11

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for var in GITHUB_TOKEN GITHUB_REPOSITORY; do
if [[ -z "${!var}" ]]; then
echo "$ME: cannot query github: \$$var is undefined" >&2
return 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just turn this into exit 1?

This gave a reasonable error message, with the change now we get the full no tests message if GITHUB_TOKEN/GITHUB_REPOSITORY is missing from the env which will be confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants