Skip to content

Commit

Permalink
Add workflow to automatically push 'latest.csv' to public repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pvfrota committed Sep 29, 2024
1 parent 26b166c commit 42d21cd
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/commit-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Push 'latest.csv' to public repo

on:
push:
paths:
- 'processed/latest.csv'

jobs:
commit-latest:
runs-on: ubuntu-latest

steps:
- name: Checkout source repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Git user for the action
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Clone only the master branch of the target repository
run: |
git clone --single-branch --branch master https://github.com/GrupoDaMudanca/cod-results.git target-repo
env:
GITHUB_TOKEN: ${{ secrets.PUSH_COD_RESULTS_TOKEN }}

- name: Copy the latest.csv file to the target repository
run: |
cp processed/latest.csv target-repo/latest.csv
- name: Commit and push changes to the target repository
run: |
cd target-repo
git add latest.csv
git commit -m "Update data $(date -u '+%Y-%m-%d %T') UTC"
git push origin master
env:
GITHUB_TOKEN: ${{ secrets.PUSH_COD_RESULTS_TOKEN }}

0 comments on commit 42d21cd

Please sign in to comment.