Skip to content

Scrape OpenAI data #156

Scrape OpenAI data

Scrape OpenAI data #156

Workflow file for this run

name: Scrape OpenAI data
on:
push:
workflow_dispatch:
schedule:
- cron: '1 2 * * *'
permissions:
contents: write
jobs:
ai-scraper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Scrape
run: |
export FILEPATH="openai/api/models.txt"
curl https://api.openai.com/v1/models -H "Authorization: Bearer ${{ secrets.OPENAI_API_KEY }}" | jq -r '.data | .[] | .id' | sort -n > ${FILEPATH}
- name: Commit and push
run: |-
git config user.name "Automated"
git config user.email "[email protected]"
git add -A
timestamp=$(date -u)
git commit -m "${timestamp}" || exit 0
git pull --rebase
git push