sort-scraped-data #825
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
| # This is a basic workflow to help you get started with Actions | |
| name: sort-scraped-data | |
| # Controls when the workflow will run | |
| on: | |
| schedule: | |
| - cron: 55 05 * * * # Runs once daily at 05:55 UTC | |
| workflow_dispatch: | |
| concurrency: | |
| group: scrape-and-schedule | |
| cancel-in-progress: false | |
| # A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
| jobs: | |
| # This workflow contains a single job called "scrape" | |
| sort: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| - name: checkout repo content | |
| uses: actions/checkout@v3 # checkout the repository content to github runner. | |
| - name: setup python | |
| uses: actions/setup-python@v4 | |
| # with: | |
| # python-version: 3.8.2 | |
| - name: execute py script # run sort-scraped-data.py to sort csv files into folders | |
| run: | | |
| python sort-scraped-data.py | |
| - name: Commit and push if it changed | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| git pull | |
| git add -A | |
| timestamp=$(date -u) | |
| if ! git diff-index --quiet HEAD; then | |
| git commit -m "Sorted on [${timestamp}]" | |
| git push "https://${GITHUB_ACTOR}:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD || exit 0 | |
| fi | |
| #EOF |