From 1cad60d61625e2c6ecc180e8be26b309913ef220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandru=20S=C4=83vulescu?= Date: Thu, 8 Feb 2024 22:20:53 +0100 Subject: [PATCH] Auto-apply formatting from PR (#2395) when the code formatting check fails, run code formatting and push the changes to the same PR branch. --- .github/workflows/formatting.yml | 21 +++++++++++++++++++++ src/nrniv/netpar.cpp | 2 ++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/formatting.yml b/.github/workflows/formatting.yml index ab3e59723d..8b6dbf62db 100644 --- a/.github/workflows/formatting.yml +++ b/.github/workflows/formatting.yml @@ -27,3 +27,24 @@ jobs: - name: Check formatting working-directory: ${{runner.workspace}}/nrn run: external/coding-conventions/bin/format -v --dry-run + + # If formatting fails, apply formatting and push changes. + # This will trigger another workflow run, which will cancel the current one. + - name: Apply formatting + working-directory: ${{runner.workspace}}/nrn + if: failure() && github.event_name == 'pull_request' + run: | + # Checkout PR + gh pr checkout ${{ github.event.pull_request.number }} + + # Apply formatting + external/coding-conventions/bin/format -v + + # Commit & push changes + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -u :/ + git commit -a -m "Fix formatting" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/nrniv/netpar.cpp b/src/nrniv/netpar.cpp index d3fd888479..249d577a2b 100644 --- a/src/nrniv/netpar.cpp +++ b/src/nrniv/netpar.cpp @@ -240,6 +240,8 @@ NetParEvent::~NetParEvent() {} void NetParEvent::send(double tt, NetCvode* nc, NrnThread* nt) { nc->event(tt + usable_mindelay_, this, nt); } + + void NetParEvent::deliver(double tt, NetCvode* nc, NrnThread* nt) { int seq; if (nrn_use_selfqueue_) { // first handle pending flag=1 self events