Summarize Articles #127
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: Summarize Articles | |
env: | |
FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }} | |
on: | |
workflow_dispatch: | |
inputs: | |
force_generate_all: | |
description: 'Force generate summaries for all posts' | |
required: false | |
type: boolean | |
default: false | |
schedule: | |
- cron: '0 10 * * 2' | |
jobs: | |
scheduled: | |
runs-on: ubuntu-latest | |
environment: summarize | |
steps: | |
- name: Check out this repo | |
uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements-summarizer.txt | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-build.txt | |
python -m pip install -r requirements-summarizer.txt | |
python -m pip install -r requirements-langchain.txt | |
- name: Fetch File from Repo #2 | |
run: | | |
curl -f -O "https://raw.githubusercontent.com/wesslen/arxiv-frontpage/main/data/input.jsonl" | |
mv input.jsonl data/input.jsonl | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add data/input.jsonl | |
timestamp=$(date -u) | |
git commit -m "Update input.jsonl from Frontpage: ${timestamp}" || exit 0 | |
git push | |
- name: Run summarization | |
run: | | |
FORCE_FLAG="" | |
if [ ${{ github.event.inputs.force_generate_all }} = true ]; then | |
FORCE_FLAG="--force-generate-all" | |
fi | |
python scripts/summarizer.py data/input.jsonl $FORCE_FLAG | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Automated" | |
git config user.email "actions@users.noreply.github.com" | |
git add data/output.jsonl | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
git push |