mirror of https://github.com/Chizi123/Arch-autobuild-repo.git

Joel Grunbaum
yesterday 700cfa5a81dab4a8e22136fe6a889a346df4bb04
Add an option to email on every build or only on failures
3 files modified
5 ■■■■ changed files
config/config.example.yaml 2 ●●●●● patch | view | raw | blame | history
src/archrepobuild/config.py 1 ●●●● patch | view | raw | blame | history
src/archrepobuild/notifications.py 2 ●●● patch | view | raw | blame | history
config/config.example.yaml
@@ -41,6 +41,8 @@
  email:
    # Enable email notifications on build failures
    enabled: false
    # Send email every time the script is run or only on failures
    email_everytime: true
    # Recipient email address
    to: ""
    # Sender email address
src/archrepobuild/config.py
@@ -38,6 +38,7 @@
    """Email notification settings."""
    enabled: bool = Field(default=False, description="Enable email notifications")
    email_everytime: bool = Field(default=False, description="Send email every time the script is run")
    to: str = Field(default="", description="Recipient email address")
    from_addr: str = Field(default="", alias="from", description="Sender email address")
    smtp_host: str = Field(default="localhost", description="SMTP server host")
src/archrepobuild/notifications.py
@@ -106,7 +106,7 @@
    async def send(self, summary: BuildSummary, config: Config) -> bool:
        """Send email notification."""
        if not self.config.enabled:
        if not self.config.enabled and (self.config.email_everytime or summary.failed == 0):
            return True
        if not self.config.to: