Comments (8)
Hi, @MichaelJJ
from stale.
Hello @MichaelJJ,
While trying to reproduce the problem it occurred to me i did not understand the issue well.
the branch is from a fork
according to the description literally means a branch of the other repo used to create a PR
So can the desired behaviour be said as "do not attempt to delete the branches for the staled PR"?
from stale.
I believe the simplest fix would be to check if the PR head is a fork repository, skip branch deletion for that PR even if the option is enabled.
Here is an example:
I fork a repo, and commit changes to a branch named "test-branch" on the Fork. I create a Pull Request from Fork branch "test" to the parent (original) repo.
The Pull Request becomes stale, and I have the delete branch option enabled. When the stale job runs, it closes the Pull Request in the parent (original) repo and then attempts to delete a branch named "test-branch" in Repo A, even though the PR branch originates from a fork.
If you look at the code here: https://github.com/actions/stale/blob/main/src/classes/issues-processor.ts#L923 it is simply looking for the PR branch name, and should also be checking if the PR originates from a fork. If my PR head is "ForkA:test-branch", the code pullRequest.head.ref
will simply return test-branch
, which may result in deleting a branch that should not be removed.
from stale.
@MichaelJJ , and here we are
https://github.com/actions/stale/pull/913/files#diff-93e32a46e13f11c2066be36506b0f153d7da2b6b8d787da9177c10692ce50fc5R926
The idea is: delete the branch if
pullRequest.head.repo === null
-- PR's branch is not forked
orpullRequest.head.repo.full_name === '${context.repo.owner}/${context.repo.repo}'
- PR is from the same repo
Do you think we are on the same page?
from stale.
I think that would cover it, the branch would only be deleted if the PR head is the repo, and not a fork. Thanks!
from stale.
@MichaelJJ The related PR merged and can be used immediately with
- uses: actions/stale@main
from stale.
Hello @MichaelJJ , i am closing the issue because the related PR has been merged, but please feel free to reopen it or create new one if the problem still exists.
from stale.
hi @MichaelJJ, we have released a new major version of action, that is including a fix for this issue.
Could you confirm everything works as expected?
from stale.
Related Issues (20)
- read config from file HOT 1
- Issues marked as stale but not closing HOT 1
- Bot removes label HOT 9
- Bot closes issues as completed despite configuration HOT 4
- - [x] []()```
- Hide bot comment when stale label is removed HOT 2
- Action doesn't fail on invalid credentials HOT 4
- Exampt pr/issue with owner HOT 3
- Exempt PR's stale for only specific author names. HOT 1
- Option to limit notifications per run HOT 4
- Error "Resource not accessible by integration" HOT 10
- Provide output from stale workflow to allow subsequent jobs to send notifications HOT 1
- add seperated labels-to-remove-when-unstale for issues and PRs HOT 2
- Should scan starting with oldest PR rather than newest PR HOT 3
- Not handling a repo with many PRs and many stale PRs in a useful manner HOT 8
- Issues closed by stale Github action is not invoking closed events. HOT 4
- Do not close pinned issues HOT 1
- [Feature Request] Support for Discussions HOT 6
- Option to ignore issues/PRs with no comments HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stale.