Commit a14977ea authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

explicit hrp2 message for PR on master

parent ade0f209
Pipeline #11495 failed with stage
in 5 minutes and 28 seconds
...@@ -7,9 +7,6 @@ from hashlib import sha1 ...@@ -7,9 +7,6 @@ from hashlib import sha1
from ipaddress import ip_address, ip_network from ipaddress import ip_address, ip_network
from json import loads from json import loads
import git
import github
from autoslug.utils import slugify
from django.conf import settings from django.conf import settings
from django.core.mail import mail_admins from django.core.mail import mail_admins
from django.http import HttpRequest from django.http import HttpRequest
...@@ -19,9 +16,14 @@ from django.shortcuts import get_object_or_404, reverse ...@@ -19,9 +16,14 @@ from django.shortcuts import get_object_or_404, reverse
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
import git
import github
from autoslug.utils import slugify
from dashboard.middleware import ip_laas from dashboard.middleware import ip_laas
from rainboard.models import Namespace, Project from rainboard.models import Namespace, Project
from rainboard.utils import SOURCES from rainboard.utils import SOURCES
from . import models from . import models
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -54,8 +56,9 @@ def pull_request(request: HttpRequest, rep: str) -> HttpResponse: ...@@ -54,8 +56,9 @@ def pull_request(request: HttpRequest, rep: str) -> HttpResponse:
if not project.accept_pr_to_master and pr_branch == 'master' \ if not project.accept_pr_to_master and pr_branch == 'master' \
and 'devel' in [b.name for b in gh.get_branches()] and login != namespace.slug_github: and 'devel' in [b.name for b in gh.get_branches()] and login != namespace.slug_github:
logger.info(f"{namespace.slug}/{project.slug}: New pr {data['number']} to master") logger.info(f"{namespace.slug}/{project.slug}: New pr {data['number']} to master")
pr.create_issue_comment("This project doesn't accept pull requests on master, please change the base " pr.create_issue_comment("Hi ! This project doesn't usually accept pull requests on master. If this wasn't "
"branch of your pull request to devel.") "intentionnal, you can change the base branch of this pull request to devel "
"(No need to close it for that). Best, a bot.")
gh_remote_name = f'github/{login}' gh_remote_name = f'github/{login}'
if gh_remote_name not in git_repo.remotes: if gh_remote_name not in git_repo.remotes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment