Uploaded updated file #202
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# | |
# See https://github.com/r-lib/actions/tree/master/examples#readme for | |
# additional example workflows available for the R community. | |
#Daily scraping | |
#name: Global Merchandise Trade | |
#on: | |
# schedule: | |
# - cron: "0 2 * * *" # every day at 4 am | |
#FORCE_JAVASCRIPT_ACTIONS_TO_NODE20=true | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
jobs: | |
autoscrape: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Load repo and install R | |
steps: | |
- uses: actions/checkout@v3 | |
# Set up Node.js 20 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- uses: r-lib/actions/setup-r@v2 | |
# Set-up R | |
- name: Install packages | |
run: | | |
Rscript -e "install.packages(c('dplyr', 'stringr','readxl','janitor'), repos='https://cloud.r-project.org')" | |
# - name: Delete old csv file | |
# run: | | |
# if (file.exists("Data/Global_merchandise_trade.csv")) { | |
# unlink("Data/Global_merchandise_trade.csv") | |
# } | |
# | |
# - name: Delete old xlsx file | |
# run: | | |
# if (file.exists("Data/Global_Merchandise_Trade.xlsx")) { | |
# unlink("Data/Global_Merchandise_Trade.xlsx") | |
# } | |
#- name: Remove file | |
# run: git rm Data/Global_Merchandise_Trade.xlsx | |
# Run R script | |
- name: Global Merchandise Trade | |
run: Rscript Global_Merchandise_Trade.R | |
# Add new files in data folder, commit along with other modified files, push | |
- name: Commit files | |
run: | | |
git config --local user.name github-actions | |
git config --local user.email "actions@github.com" | |
git pull origin main | |
git add Data/* | |
git commit -am "GH ACTION Autorun $(date)" | |
git push origin main | |
env: | |
REPO_KEY: ${{secrets.GITHUB_TOKEN}} | |
username: github-actions |