Skip to content

Commit

Permalink
Add Notification for failure to add deploy key on manual imported pro…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
stsewd committed Aug 29, 2024
1 parent 237928f commit 8c19795
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion readthedocs/oauth/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.utils.translation import gettext_lazy as _

from readthedocs.notifications.constants import ERROR, INFO
from readthedocs.notifications.constants import ERROR, INFO, WARNING
from readthedocs.notifications.messages import Message, registry

MESSAGE_OAUTH_WEBHOOK_NO_PERMISSIONS = "oauth:webhook:no-permissions"
Expand All @@ -15,6 +15,9 @@
"oauth:deploy-key:attached-successfully"
)
MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED = "oauth:deploy-key:attached-failed"
MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED_ON_MANUAL_IMPORTED_PROJECT = (
"oauth:deploy-key:attached-failed-unknown-repo"
)

messages = [
Message(
Expand Down Expand Up @@ -96,5 +99,21 @@
),
type=ERROR,
),
Message(
id=MESSAGE_OAUTH_DEPLOY_KEY_ATTACHED_FAILED_ON_MANUAL_IMPORTED_PROJECT,
header=_("Failed to add deploy key to project"),
body=_(
textwrap.dedent(
"""
We were unable to find this repository in your {{ provider_name }} account.
If this is a private repository, you'll need to
<a href="https://docs.readthedocs.io/page/guides/importing-private-repositories.html">
add the deploy key manually
</a>.
"""
).strip(),
),
type=WARNING,
),
]
registry.add(messages)

0 comments on commit 8c19795

Please sign in to comment.