Run Arxiv Sanity Bot #1462
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: Run Arxiv Sanity Bot | |
on: | |
schedule: | |
- cron: "15 1,13 * * *" | |
workflow_dispatch: | |
inputs: | |
window_start: | |
description: "Start of the window in days. Ex. 48 means that the window starts 48 hours ago" | |
default: "96" | |
type: "string" | |
window_stop: | |
description: "Stop of the window in days. Ex. 24 means that the window stops 24 hours ago" | |
default: "-24" # negative means in the future. This is to neutralize time zone differences | |
type: "string" | |
jobs: | |
run_arxiv_sanity_bot: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Cache parquet dataframe of processed abstracts | |
uses: actions/cache@v3 | |
with: | |
key: arxiv-sanity-bot-cache | |
path: | | |
posted_abstracts.parquet | |
~/.cache/pip | |
- name: Install dependencies | |
run: | | |
pip install . | |
- name: Run Arxiv Sanity Bot | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} | |
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} | |
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} | |
FIREBASE_CREDENTIALS: ${{ secrets.FIREBASE_CREDENTIALS }} | |
run: | | |
if [ ${{ inputs.window_start }} != "" ]; then | |
arxiv-sanity-bot --window_start ${{ inputs.window_start }} --window_stop ${{ inputs.window_stop }} | |
else | |
if [ $(date +%a) == "Mon" ]; then | |
echo "Setting window_start to 96 because it is Monday" | |
export WINDOW_START=96 | |
else | |
echo "Setting window_start to 72" | |
export WINDOW_START=72 | |
fi | |
arxiv-sanity-bot --window_start $WINDOW_START --window_stop -24 | |
fi | |