Generate New Posts #91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate New Posts | |
on: | |
schedule: | |
- cron: '0 6 * * *' # 3 da manhã no Brasil | |
jobs: | |
post: | |
name: post | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f python/requirements.txt ]; then pip install -r python/requirements.txt; fi | |
- name: Run scrapy for all sources | |
run: | | |
cd python/scraper/eletrificado | |
scrapy crawl electrek -O ../../electrek.json | |
scrapy crawl insideevs -O ../../insideevs.json | |
- name: Generate MD post files | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
cd python | |
python create_md.py | |
# Adicionando os arquivos gerados, commitando e enviando para o repositório | |
- name: Add and Commit changes | |
run: | | |
git config --global user.name "GitHub Action" | |
git config --global user.email "[email protected]" | |
git add ./content | |
git add ./python/processed_links.json | |
git commit -m "Create new posts" | |
git push |