by sighingnow · 4y ago · 0 comments
After further inspection, we found that the merge event is triggered by the creator of the pull request pushing current main commits to the PR's "from" branch.
Moreover, when pushing current main to a pull request,
- The pull request is displayed as "Merged"
- A "PR merged into main" email is sent to all subscribers (mainly the repo owners)
- A "PR merged" contribution is displayed on the creator's Github profile
Closing dangling pull requests is a quite resonable design, but mark it as "Merged" rather than "Closed" would confuse people to let them think they are hacked at the first glance (note that there even an email notification "Merged #xxxx into main" to repo's owners).
If such a feature is misused, it may lead to chaos to more open source repos in the futuer, especially those famous ones.
See some example links in
* create an action that only runs on branches with a specific pattern
* create another action that only runs on branches with a different pattern
* push a commit to a branch with the first pattern, create a PR
* create a new branch with the second pattern
* push the same commit on the second branch
* watch things get confused on the PR that was originally created1) Is it a real problem that allows anyone to push into any repository?
2) Is it just a very confusing message?
It is not a real problem that allows anyone to push into any repo, but is a real problem that shows a incorrect/unexpected "Merged" pull request status on any repository.
> 2) Is it just a very confusing message?
From the links in paste in the comments you could see that github shows the unauthorized user "merged" the pull request into main, and, the repo's owner received a email says:
FROM: XXXXX Content: Merged #xxx into main.
It is exactly the SAME as email notification of a normal authorized merge event.
Basically, aside from github's merge button (which does magic inaccessible to mere mortal[0]) the signal github looks for to know whether a PR is merged is whether the PR's head commit is in the target branch.
So if you reset the PR's branch to the target (or any of its commit), as far as github is concerned it's as if the PR had been merged.
[0] the ability to close PRs as merged was requested 3 years ago on the old discourse forum, which was deleted when github deployed the new community thingie, the request was reposted on the new site https://github.com/community/community/discussions/12437
It would cause some confusion for project management, I guess.
EDIT: Since bifenglin didn't get marked as a contributor in the second example from GP above I wonder if it's not actually possible. It could require a commit physically in the repo with an email linked to your account.