diff --git a/.github/workflows/update_tech_digest.yml b/.github/workflows/update_tech_digest.yml new file mode 100644 index 00000000..7242bf0d --- /dev/null +++ b/.github/workflows/update_tech_digest.yml @@ -0,0 +1,34 @@ +name: Update Tech Digest + +on: + schedule: + # Runs every Monday at 00:00 UTC + - cron: '0 0 * * 1' + +jobs: + update_content: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests beautifulsoup4 + + - name: Update Weekly Review + run: python update_weekly_review.py + + - name: Commit and push changes + run: | + git config --global user.name 'GitHub Actions' + git config --global user.email 'actions@github.com' + git add . + git commit -m 'Update Tech Digest' || echo "No changes to commit" + git push diff --git a/.github/workflows/update_weekly_review.py b/.github/workflows/update_weekly_review.py new file mode 100644 index 00000000..93387909 --- /dev/null +++ b/.github/workflows/update_weekly_review.py @@ -0,0 +1,48 @@ +import requests +from bs4 import BeautifulSoup +import datetime + +# List of blog URLs to scrape +blog_urls = [ + 'https://engineering.fb.com/2024/03/18/data-infrastructure/logarithm-logging-engine-ai-training-workflows-services-meta/', + 'https://www.databricks.com/blog/introducing-dbrx-new-state-art-open-llm', + 'https://discord.com/blog/our-quest-to-support-game-developers' +] + +# Function to scrape blog details from a given URL +def scrape_blog_details(url): + response = requests.get(url) + soup = BeautifulSoup(response.content, 'html.parser') + + # Extract title, hero image, and description (you might need to adjust the selectors based on the site's structure) + title = soup.find('h1').get_text() + hero_image = soup.find('img')['src'] + description = soup.find('meta', {'name': 'description'})['content'] + + return { + 'title': title, + 'hero_image': hero_image, + 'description': description, + 'link': url + } + +# Main function to generate the weekly review Markdown file +def generate_weekly_review(): + all_blogs = [scrape_blog_details(url) for url in blog_urls] + + # Generate Markdown content with blog cards + markdown_content = '# Weekly Review\n\n' + for blog in all_blogs: + markdown_content += f"![{blog['title']}]({blog['hero_image']})\n" + markdown_content += f"### [{blog['title']}]({blog['link']})\n" + markdown_content += f"{blog['description']}\n\n" + + # Write to a Markdown file with the current date as the filename + filename = f'weekly_review_{datetime.date.today()}.md' + with open(filename, 'w') as file: + file.write(markdown_content) + + print(f'Weekly review file generated: {filename}') + +#if __name__ == '__main__': + #generate_weekly_review() diff --git a/src/components/HorizontalCard.astro b/src/components/HorizontalCard.astro index 1dabc0a8..e4e09833 100644 --- a/src/components/HorizontalCard.astro +++ b/src/components/HorizontalCard.astro @@ -5,7 +5,7 @@ const { title, img, desc, url, badge, tags, target = '_blank' } = Astro.props;
- {img && {title}} + {img && {title}}

{title} diff --git a/src/components/SideBar.astro b/src/components/SideBar.astro index 52e92afb..31967b02 100644 --- a/src/components/SideBar.astro +++ b/src/components/SideBar.astro @@ -17,6 +17,7 @@
  • Blog
  • Resume
  • Meal Planner
  • +
  • Tech Weekly Digest
  • Book a Call
  • Support My Work
  • @@ -54,7 +55,7 @@ width="24" height="24" viewBox="0 0 24 24" - style="fill: currentColor;transform: ;msFilter:;" + style="fill: currentColor;" > @@ -64,7 +65,7 @@ + style="fill: currentColor;"> diff --git a/src/pages/techdigest.astro b/src/pages/techdigest.astro new file mode 100644 index 00000000..d36277a8 --- /dev/null +++ b/src/pages/techdigest.astro @@ -0,0 +1,63 @@ +--- +import BaseLayout from "../layouts/BaseLayout.astro"; +import HorizontalCard from "../components/HorizontalCard.astro"; +--- + + +
    +
    Tech Weekly Digest 💡
    +
    + + +
    + + +
    + +
    + +
    + +
    + +
    + + +