Skip to content
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

FEAT(CICD): Post deploy step to check if report emeal has arrived #290

Open
2 tasks done
vfedotovs opened this issue Aug 17, 2024 · 0 comments
Open
2 tasks done

FEAT(CICD): Post deploy step to check if report emeal has arrived #290

vfedotovs opened this issue Aug 17, 2024 · 0 comments
Labels
build Changes to the build process or tools. feat New feature or request

Comments

@vfedotovs
Copy link
Owner

Web Scraper version checks

  • I have checked that this feature has not already been reported.

  • I have confirmed this feature does not exists on the latest version of Web Scraper.

Describe feature in detail

Example code of check_mail.py 


import imaplib
import email
from email.header import decode_header
import os

# Environment variables for Gmail credentials
GMAIL_USER = os.getenv("GMAIL_USER")
GMAIL_PASSWORD = os.getenv("GMAIL_PASSWORD")

def check_email(subject_to_check="Your Expected Subject"):
    # Connect to Gmail's IMAP server
    mail = imaplib.IMAP4_SSL("imap.gmail.com")

    # Log in to the server
    mail.login(GMAIL_USER, GMAIL_PASSWORD)

    # Select the mailbox you want to check (e.g., 'inbox')
    mail.select("inbox")

    # Search for emails with the specified subject
    status, messages = mail.search(None, '(SUBJECT "{}")'.format(subject_to_check))

    # If emails with the subject are found
    if messages[0]:
        print("Email with subject '{}' found.".format(subject_to_check))
    else:
        print("No email with subject '{}' found.".format(subject_to_check))

    # Logout
    mail.logout()

if __name__ == "__main__":
    check_email()


Example of possible github actions step  
name: Check Gmail for Email

```yaml
on:
  workflow_dispatch:
  schedule:
    - cron: '*/15 * * * *'  # Runs every 15 minutes (adjust as needed)

jobs:
  check-email:
    runs-on: ubuntu-latest

    steps:
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'

    - name: Install Required Packages
      run: |
        python -m pip install --upgrade pip
        pip install imapclient

    - name: Check Gmail for Email
      env:
        GMAIL_USER: ${{ secrets.GMAIL_USER }}
        GMAIL_PASSWORD: ${{ secrets.GMAIL_PASSWORD }}
      run: |
        python check_email.py
@vfedotovs vfedotovs added the feat New feature or request label Aug 17, 2024
@vfedotovs vfedotovs changed the title FEAT: FEAT(CICD): Post deploy step to check if report emeal has arrived Aug 17, 2024
@vfedotovs vfedotovs added the build Changes to the build process or tools. label Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Changes to the build process or tools. feat New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant