Skip to content

Commit

Permalink
Auto-apply formatting from PR (#2395)
Browse files Browse the repository at this point in the history
when the code formatting check fails, run code formatting
and push the changes to the same PR branch.
  • Loading branch information
alexsavulescu authored Feb 8, 2024
1 parent f7aba0a commit 1cad60d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 2 additions & 0 deletions src/nrniv/netpar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cad60d

Please sign in to comment.