-
-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only comment about new commits if the PR is still open. #583
Open
Mariatta
wants to merge
1
commit into
python:main
Choose a base branch
from
Mariatta:fix-new-commit-pushed
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1123,6 +1123,7 @@ async def test_new_commit_pushed_to_approved_pr(issue_url_key): | |
], | ||
# the key could be 'url' or 'issue_url' | ||
issue_url_key: "/repos/python/cpython/issues/5547", | ||
"state": "open", | ||
} | ||
], | ||
}, | ||
|
@@ -1193,6 +1194,7 @@ async def test_new_commit_pushed_to_not_approved_pr(issue_url_key): | |
], | ||
# | ||
issue_url_key: "/repos/python/cpython/issues/5547", | ||
"state": "open", | ||
} | ||
], | ||
}, | ||
|
@@ -1214,3 +1216,39 @@ async def test_pushed_without_commits(): | |
|
||
# no posts | ||
assert len(gh.post_) == 0 | ||
|
||
|
||
@pytest.mark.parametrize("issue_url_key", ["url", "issue_url"]) | ||
async def test_new_commit_pushed_to_closed_pr(issue_url_key): | ||
# There is new commit on approved PR | ||
sha = "f2393593c99dd2d3ab8bfab6fcc5ddee540518a9" | ||
data = {"commits": [{"id": sha}]} | ||
event = sansio.Event(data, event="push", delivery_id="12345") | ||
items = { | ||
f"https://api.github.com/search/issues?q=type:pr+repo:python/cpython+sha:{sha}": { | ||
"total_count": 1, | ||
"items": [ | ||
{ | ||
"number": 5547, | ||
"title": "[3.6] bpo-32720: Fixed the replacement field grammar documentation. (GH-5544)", | ||
"body": "\n\n`arg_name` and `element_index` are defined as `digit`+ instead of `integer`.\n(cherry picked from commit 7a561afd2c79f63a6008843b83733911d07f0119)\n\nCo-authored-by: Mariatta <[email protected]>", | ||
"labels": [ | ||
{ | ||
"name": "CLA signed", | ||
}, | ||
{ | ||
"name": "awaiting review", | ||
}, | ||
], | ||
# | ||
issue_url_key: "/repos/python/cpython/issues/5547", | ||
"state": "closed", | ||
} | ||
], | ||
}, | ||
} | ||
gh = FakeGH(getitem=items) | ||
await awaiting.router.dispatch(event, gh) | ||
|
||
# no posts | ||
assert len(gh.post_) == 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be replaced by an
if 'awaiting merge' in utils.labels(pr):
, and possibly combined with the previous if?