Compare commits
No commits in common. "04b3baaba266d332ddf86a4423853cf129510f8a" and "e56463d20710dcc85761fb8dbe620db7eb65121b" have entirely different histories.
04b3baaba2
...
e56463d207
|
@ -166,20 +166,6 @@ class GiteaClient:
|
||||||
}
|
}
|
||||||
|
|
||||||
response = self.session.post(url, json=json_data)
|
response = self.session.post(url, json=json_data)
|
||||||
# If a pull request for this head/base already exists, return it instead of crashing
|
|
||||||
if response.status_code == 422:
|
|
||||||
logger.warning(
|
|
||||||
'Pull request already exists for head %s and base %s', head, base,
|
|
||||||
)
|
|
||||||
prs = self.get_pull_requests(owner, repo)
|
|
||||||
for pr in prs:
|
|
||||||
if (
|
|
||||||
pr.get('head', {}).get('ref') == head
|
|
||||||
and pr.get('base', {}).get('ref') == base
|
|
||||||
):
|
|
||||||
return pr
|
|
||||||
# fallback to raise if we can’t find it
|
|
||||||
response.raise_for_status()
|
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
@ -196,15 +182,3 @@ class GiteaClient:
|
||||||
response = self.session.get(url)
|
response = self.session.get(url)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
def get_pull_requests(
|
|
||||||
self,
|
|
||||||
owner: str,
|
|
||||||
repo: str,
|
|
||||||
state: str = 'open',
|
|
||||||
) -> list[dict]:
|
|
||||||
"""Fetch pull requests for a repository."""
|
|
||||||
url = f'{self.gitea_url}/repos/{owner}/{repo}/pulls?state={state}'
|
|
||||||
response = self.session.get(url)
|
|
||||||
response.raise_for_status()
|
|
||||||
return response.json()
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user