Run data collection #302
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: Run data collection | |
| on: | |
| push: | |
| paths: | |
| - '.tracked_repos' | |
| - '**.R' | |
| - '.github/workflows/run_job.yaml' | |
| schedule: | |
| - cron: '59 23 * * 0' | |
| jobs: | |
| data-collection: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@master | |
| - uses: r-lib/actions/setup-r@v2 | |
| - name: Set GIT | |
| run: | | |
| git config --global user.email "action@github.com" | |
| git config --global user.name "Github Action" | |
| - name: Run Rscript | |
| run: Rscript update.R | |
| - name: Get Date | |
| id: date | |
| run: echo "::set-output name=date::$(TZ=UTC date +%Y-%m-%d_%H-%M-%S)" | |
| - name: Get Branch | |
| id: branch | |
| run: echo "::set-output name=branch_name::${GITHUB_REF:11}" | |
| - name: Commit new data | |
| run: | | |
| git add --all | |
| git commit -m "New data collected at ${{ steps.date.outputs.date }}" || echo "No changes since last update" | |
| - name: Push data | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ steps.branch.outputs.branch_name }} |