Fetch CSV from Private Repo #3
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
name: Fetch CSV from Private Repo | |
on: | |
workflow_dispatch: # Enable manual trigger | |
schedule: | |
# Run the job on the 13th of every month at 00:10 UTC | |
- cron: '10 0 13 * *' | |
jobs: | |
fetch_csv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the public repository | |
uses: actions/checkout@v3 | |
- name: Checkout the private repository | |
uses: actions/checkout@v3 | |
with: | |
repository: CommunityScale/Automation # Private repo | |
token: ${{ secrets.REPO_PAT }} # Use a PAT stored in repository secrets | |
path: private-repo | |
- name: Copy the CSV file, overwriting the existing file | |
run: cp -f private-repo/c_income_zhvi_mortgage_comprehensive_affordability.csv . | |
- name: Ensure the file is staged for commit | |
run: git add -A c_income_zhvi_mortgage_comprehensive_affordability.csv | |
- name: Commit the CSV file | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -m "Overwrite CSV from private repo" | |
git push |