fetch #16
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: fetch | |
on: | |
schedule: | |
- cron: '0 17 */3 * *' | |
workflow_dispatch: | |
jobs: | |
fetch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: eifinger/setup-rye@v4 | |
with: | |
enable-cache: true | |
- run: rye sync | |
- run: | | |
LOG_CONTEXT=$(echo "{\"run_id\": \"${{ github.run_id }}-${{ github.run_number }}\"}") | |
echo "LOG_CONTEXT=$LOG_CONTEXT" >> $GITHUB_ENV | |
# NOTE: `latest` Release must already exist. Create manually if needed | |
- uses: robinraju/release-downloader@v1 | |
with: | |
latest: true | |
fileName: 'out.json' | |
out-file-path: 'release-artifacts' | |
- run: python src/roxie_theater/scrape.py -o step_1.json --prior-output-file release-artifacts/out.json -l "$LOG_CONTEXT" | |
- run: python src/roxie_theater/llm_extract.py -f step_1.json -o step_2.json -l "$LOG_CONTEXT" | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
- run: python src/roxie_theater/id_movies.py -f step_2.json -o out.json -l "$LOG_CONTEXT" | |
env: | |
TMDB_TOKEN: ${{ secrets.TMDB_TOKEN }} | |
- run: python src/roxie_theater/prepare_import.py -f out.json -o out.csv -l "$LOG_CONTEXT" | |
- run: echo "DATE=$(date +'%Y_%m_%d')" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.DATE }}.json" | |
path: out.json | |
retention-days: 7 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.DATE }}.csv" | |
path: out.csv | |
retention-days: 7 | |
- uses: ncipollo/release-action@v1 | |
with: | |
tag: latest | |
artifacts: out.json | |
allowUpdates: true | |
replacesArtifacts: true | |
makeLatest: true | |
artifactContentType: json | |
name: Latest Output JSON | |
body: Created from ${{ env.DATE }} run. |