running multiple workflows in same data repo is hit or miss
olets opened this issue · 1 comments
I've set up multiple GHRS jobs in a single repo, so that I can have one place to see reports for multiple stats repos.
When I run the jobs (either from single-stats-repo workflows, or as separate jobs in a single "all my GHRS" workflows) some succeed and some fail.
It looks like there's a race condition where one job can push an update after another's pull.
I've tried various approaches to sequential actions and haven't found a great solution. But I'm new to Actions, I bet there there is one.
Still, a well placed git pull
might solve this.
210328-21:02:14.770 INFO: done
+ git add latest-report
+ set +x
generate README.md
+ git add README.md
+ git commit -m 'ghrs: report 03-28-2102-4031 for <owner>/<stats repo>'
[github-repo-stats 9c1e9a3] ghrs: report 03-28-2102-4031 for <owner>/<stats repo>
7 files changed, 1357 insertions(+)
create mode 100644 <owner>/<stats repo>/README.md
create mode 100644 <owner>/<stats repo>/latest-report/report.html
create mode 100644 <owner>/<stats repo>/latest-report/report.md
create mode 100644 <owner>/<stats repo>/latest-report/report.pdf
create mode 100644 <owner>/<stats repo>/latest-report/report_for_pdf.html
create mode 100644 <owner>/<stats repo>/latest-report/resources/github-markdown.css
create mode 100644 <owner>/<stats repo>/latest-report/resources/template.html
+ git push --set-upstream origin github-repo-stats
To <owner>/<data repo>.git
! [rejected] github-repo-stats -> github-repo-stats (fetch first)
error: failed to push some refs to '***github.com/<owner>/<data repo>.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
@olets thanks for this great report! Indeed this is a race condition that I've run into rarely, too (for my own book-keeping: https://github.com/jgehrcke/ghrs-test/runs/2117034368?check_suite_focus=true#step:3:1700).
I've set up multiple GHRS jobs in a single repo, so that I can have one place to see reports for multiple stats repos.
Btw, this is great, and a super productive way to use this project. I'm doing that, too :-). And that's how I've run into this problem, too.
I think, indeed, most occasions will be addressed by a simple git pull
-- a more robust solution will be to retry that pull&push in a loop a couple of times, with some retrying and potentially back-off.
Will work on that soon. If you'd like to propose a patch then that's of course welcome, too! :)