Post Every Hour #4011
This file contains hidden or 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: Post Every Hour | |
on: | |
schedule: | |
- cron: "0 * * * *" # Executa a cada hora | |
workflow_dispatch: # Permite execução manual | |
jobs: | |
tweet_job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: true # Permite commit com credenciais do GitHub Actions | |
- name: Install system dependencies | |
run: sudo apt-get update && sudo apt-get install -y poppler-utils | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' # devera ser alteardo pois o modulo imghdr foi removido no python 3.13. ele identifica formato de arquivo de imagem | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run tweet script | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
API_KEY: ${{ secrets.API_KEY }} | |
API_SECRET: ${{ secrets.API_SECRET }} | |
BEARER_TOKEN: ${{ secrets.BEARER_TOKEN }} | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} | |
run: | | |
python main.py | |
# Verifica o conteúdo do arquivo view_links_download.json apos execução | |
- name: Check view_links_download.json content | |
run: cat view_links_download.json | |
# Verifica o conteúdo do last_posted_download.json após execução | |
- name: Check last_posted_download.json content | |
run: cat last_posted_download.json | |
# Commit e push dos arquivos json atualizados | |
- name: Commit JSON files | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add last_posted_download.json view_links_download.json | |
git commit -m "Atualiza arquivos JSON com novos links visualizados e postados" || echo "Nenhuma alteração para commit" | |
git push |