Skip to content

Commit 4ae8950

Browse files
committed
fix
1 parent 6b44314 commit 4ae8950

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/ubuntu.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
- uses: actions/checkout@v4
99
with:
1010
submodules: recursive
11+
fetch-depth: 0
1112
- name: Setup environment
1213
run: |
1314
sudo apt-get update
@@ -16,7 +17,14 @@ jobs:
1617
python3 -m pip install -r requirements.txt
1718
- name: Run pre-commit checks
1819
run: |
19-
pre-commit run --from-ref origin/master --to-ref HEAD
20+
# For push events, compare with previous commit
21+
if [ "${{ github.event_name }}" = "push" ]; then
22+
pre-commit run --from-ref HEAD~1 --to-ref HEAD
23+
else
24+
# For PRs, compare with base branch
25+
git fetch origin ${{ github.base_ref }}:${{ github.base_ref }}
26+
pre-commit run --from-ref ${{ github.base_ref }} --to-ref HEAD
27+
fi
2028
gcc-build:
2129
needs:
2230
- pre-commit

0 commit comments

Comments
 (0)