-
Notifications
You must be signed in to change notification settings - Fork 397
Description
Describe your issue
It appears that the delete branch option does not identify if the branch is from a fork and will attempt to delete a branch with the same name in the parent repository.
Further context
As an example, if I fork a repository, the PR branch will be my-fork:main
. If delete branch is true, then the stale action will attempt to delete branch main
in the parent (primary) repo.
The stale action should check if the closed PR branch is a fork and either skip branch deletion, or attempt to delete the branch in the fork.
Looking at the code https://github.com/actions/stale/blob/main/src/classes/issues-processor.ts#L923 the action is simply taking pullRequest.head.ref
which is simply the branch name and does not give an indication if this is a fork repo branch. The payload appears to have several ways to detect if this branch is from a fork, including pullRequest.head.repo.fork: true
or checking pullRequest.head.repo.owner
.