Revenue ton miles #640
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. | |
# Hourly scraping | |
name: Revenue ton miles | |
on: | |
schedule: | |
- cron: "0 5 * * *" # every day at 5 am | |
#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 | |
- uses: r-lib/actions/setup-r@v2 | |
# Set-up R | |
- name: Install packages | |
run: | | |
Rscript -e "install.packages(c('dplyr', 'ggplot2','readxl','janitor','stringr'), repos='https://cloud.r-project.org')" | |
# Run R script | |
- name: Revenue ton miles | |
run: Rscript Revenue_ton_miles.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 "[email protected]" | |
git pull | |
if [ -n "$(git status --porcelain)" ]; then | |
git add Data/* | |
git commit -am "GH ACTION Autorun $(date)" | |
git push origin main | |
else | |
echo "No changes to commit" | |
fi | |
git commit -am "GH ACTION Autorun $(date)" | |
git push origin main | |
env: | |
REPO_KEY: ${{secrets.GITHUB_TOKEN}} | |
username: github-actions |