Merge pull request #1 from nwspk/yh-dataexplore #82
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: Process CSV Data | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| paths: | |
| # Only run this if files have changed in the scripts or data dirs | |
| - 'scripts/**' | |
| - 'data/**' | |
| jobs: | |
| process-data: | |
| runs-on: ubuntu-latest | |
| # Skip commits made by GitHub Actions to prevent infinite loops | |
| # This email mush match the one set in the Configure stage below | |
| if: ${{ github.event_name == 'push' && github.event.head_commit.committer.email != 'actions@github.com' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| persist-credentials: false # Keep this to prevent using default token | |
| # Might want to add an extra step here to verify that something relevant has actually changed. | |
| # (rather than running for ALL changes within scripts and data dirs) | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Install dependencies | |
| run: pip install importlib-resources | |
| - name: Run processing script | |
| run: | | |
| python scripts/process.py "${{ github.sha }}" | |
| - name: Configure Git | |
| env: | |
| PUSH_KEY: ${{ secrets.PUSH_KEY }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$PUSH_KEY" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| - name: Commit and push changes | |
| run: | | |
| git remote set-url origin git@github.com:${GITHUB_REPOSITORY}.git | |
| git add results/ | |
| git commit -m "Add processed data results" | |
| git push |