Crawl #27
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: Crawl | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 2 * * 5" | |
jobs: | |
crawl: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Install packages | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | | |
any::httr | |
any::jsonlite | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
path: main_folder | |
ref: main | |
- name: Create and populate credentials file with secrets | |
working-directory: ./main_folder | |
run: | | |
echo 'openai_apikey="'"$MAPPED_OPENAI_APIKEY"'"' >> credentials.R | |
echo 'crossref_email="'"$MAPPED_CROSSREF_EMAIL"'"' >> credentials.R | |
shell: bash | |
env: | |
MAPPED_OPENAI_APIKEY : ${{ secrets.OPENAI_APIKEY }} | |
MAPPED_CROSSREF_EMAIL : ${{ secrets.CROSSREF_EMAIL }} | |
- name: Get data and produce JSON | |
working-directory: ./main_folder | |
run: | | |
Rscript crawl.R "politics" | |
Rscript crawl.R "economics" | |
Rscript crawl.R "sociology" | |
Rscript crawl.R "multidisciplinary" | |
Rscript crawl.R "migration" | |
- name: Commit results main branch | |
working-directory: ./main_folder | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add . && git commit -m "Data updated" | |
git push origin |