.github/workflows/daily-update.yml #544
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: Daily Update | |
on: | |
schedule: | |
- cron: "03 02 * * *" # 2:03 AM UTC | |
workflow_dispatch: {} | |
push: | |
paths: | |
- .github/workflows/daily-update.yml | |
jobs: | |
daily-update: | |
name: Daily Update | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Run image | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: "1.4.2" | |
- name: Install package | |
run: |- | |
poetry install | |
- name: Scrape latest data | |
run: |- | |
poetry run craigslist-data submit data.json --posted-today --num-workers 20 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-east-1 | |
AWS_ACCOUNT_ID: 529082709986 | |
CONTAINER_NAME: craigslist-data | |
- name: Commit and push if it changed | |
run: |- | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -f data.json | |
timestamp=$(date -u) | |
git commit -m "Latest data: ${timestamp}" || exit 0 | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |