-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow to automatically push 'latest.csv' to public repo
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
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
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 }} |