Skip to content

Fetch CSV from Private Repo #6

Fetch CSV from Private Repo

Fetch CSV from Private Repo #6

Workflow file for this run

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 and overwrite the existing file
run: cp -f private-repo/c_income_zhvi_mortgage_comprehensive_affordability.csv .
- name: Stage the modified file for commit
run: git add c_income_zhvi_mortgage_comprehensive_affordability.csv
- name: Display the status to ensure file is staged
run: git status # This will show whether the file is being tracked and changes are detected.
- 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" || echo "No changes to commit"
git push || echo "Nothing to push"