Skip to content

gh pr list --search <SHA> output differs between local and actions #11296

@C41M50N

Description

@C41M50N

Describe the bug

When I run a gh pr list --search <SHA> --json number query locally I get the desired output of a PR number. But when that same query is run in a GitHub action it outputs an empty JSON array. The SHA is for a merge commit on master. In both instances, a feature branch is checked out, if that matters. The action has the pull-requests: read permission. I've tried git fetch origin master in case that mattered, but the query still came up empty. I've also tried running the query with the base and head flags (individually; set to master). Also, this is in an enterprise org/repo, if that matters. Any ideas on why this might be?

Affected version

gh version 2.74.2 (2025-06-17)
https://github.com/cli/cli/releases/tag/v2.74.2

Steps to reproduce the behavior

See description.

Expected vs actual behavior

I expected the outputs to be consistent between the two environments (locally and actions)

Logs

Paste the activity from your command line. Redact if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandneeds-investigationCLI team needs to investigateneeds-triageneeds to be reviewedneeds-user-inputp3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions