Obtaining traffic data #3276
This file contains hidden or 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: Obtaining traffic data | |
| # Controls when the action will run. | |
| on: | |
| #push: | |
| # branches: main | |
| schedule: | |
| - cron: '0 9,12,16 * * *' | |
| jobs: | |
| autoscrape: | |
| # The type of runner that the job will run on | |
| runs-on: macos-latest | |
| # runs-on: ubuntu-20.04 | |
| # Load repo and install R | |
| #steps: | |
| #- uses: actions/checkout@master | |
| #- uses: r-lib/actions/setup-r@master | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: '4.2.2' | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| with: | |
| pandoc-version: '2.17.1' # The pandoc version to download (if necessary) and use. | |
| # Set-up R | |
| - name: Install packages | |
| run: | | |
| R -e 'install.packages("googleway")' | |
| R -e 'install.packages("ggplot2")' | |
| R -e 'install.packages("htmlwidgets")' | |
| R -e 'install.packages("dplyr")' | |
| # Run R script | |
| - name: Google Traffic data | |
| run: Rscript googleTraffic.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 add data/* | |
| git commit -am "GH ACTION Autorun $(date)" | |
| git push origin main | |
| env: | |
| DIRTYLITTLE: ${{secrets.DIRTYLITTLE}} | |
| REPO_KEY: ${{secrets.GITHUB_TOKEN}} | |
| username: github-actions |