Skip to content

Action cannot match an existing same-repository sync PR #85

Description

@blalor

Expected Behavior

When frog/sync already has an open pull request, the Action finds and updates that pull request.

Current Behavior

The Action requests headRepository and headRepositoryOwner from gh pr list, then compares .headRepository.nameWithOwner with the full repository name.

The GitHub CLI exposes .headRepository.name, but nameWithOwner is an empty string in this response. The comparison rejects the existing pull request. Later steps can then treat the pull request as absent.

Possible Solution

Compare both fields that the CLI populates:

.headRepositoryOwner.login == $owner and
.headRepository.name == $name

Derive $owner and $name separately from GITHUB_REPOSITORY.

Minimal Reproducible Example

For a repository with an open pull request, run:

gh pr list \
    --head frog/sync \
    --state open \
    --json number,headRepository,headRepositoryOwner

The repository object has this shape:

{
  "headRepository": {
    "name": "repo",
    "nameWithOwner": ""
  },
  "headRepositoryOwner": {
    "login": "owner"
  }
}

The current nameWithOwner == "owner/repo" condition is therefore false.

Context

The affected comparison is in action/action.yml at commit 702c4eadefe175a208290a99c36e7f4ac1390e53.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions