Skip to content

Commit e3fb4f2

Browse files
committed
Fix PR clang-format ref handling
1 parent b3b3233 commit e3fb4f2

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: CI
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
push:
59
pull_request:
@@ -16,6 +20,14 @@ jobs:
1620
fetch-depth: 0
1721
- name: Install clang-format
1822
run: sudo apt-get update && sudo apt-get install -y clang-format-18
23+
- name: Fetch diff refs
24+
env:
25+
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
26+
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
27+
run: |
28+
if [[ -n "${BASE_SHA}" ]]; then
29+
git fetch --no-tags origin "${BASE_SHA}" "${HEAD_SHA}"
30+
fi
1931
- name: Run clang-format
2032
env:
2133
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}

.github/workflows/static-analysis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Static analysis
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
5+
cancel-in-progress: true
6+
37
on: [pull_request]
48

59
jobs:

0 commit comments

Comments
 (0)