Skip to content

Commit 58374fe

Browse files
committed
fix fetch-depth option
Fix `fetch-depth` option in actions/checkout action to support multi commits. Signed-off-by: Inho Oh <webispy@gmail.com>
1 parent dbffc5e commit 58374fe

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ jobs:
55
name: checkpatch review
66
runs-on: ubuntu-latest
77
steps:
8+
- name: 'Calculate PR commits + 1'
9+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
810
- uses: actions/checkout@v3
911
with:
1012
ref: ${{ github.event.pull_request.head.sha }}
13+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
1114
- name: Info
1215
run: |
1316
echo "Repository: $GITHUB_REPOSITORY"
1417
echo "Workspace: $GITHUB_WORKSPACE"
1518
pwd
1619
ls -la `pwd`
20+
git log --oneline --graph
1721
- name: Run checkpatch review
1822
uses: webispy/checkpatch-action@master
1923
env:

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ jobs:
3030
name: checkpatch review
3131
runs-on: ubuntu-latest
3232
steps:
33+
- name: 'Calculate PR commits + 1'
34+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
3335
- uses: actions/checkout@v3
3436
with:
3537
ref: ${{ github.event.pull_request.head.sha }}
38+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
3639
- name: Run checkpatch review
3740
uses: webispy/checkpatch-action@v9
3841
```
@@ -48,9 +51,12 @@ jobs:
4851
name: checkpatch review
4952
runs-on: ubuntu-latest
5053
steps:
54+
- name: 'Calculate PR commits + 1'
55+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
5156
- uses: actions/checkout@v3
5257
with:
5358
ref: ${{ github.event.pull_request.head.sha }}
59+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
5460
- name: Run DPDK checkpatches.sh review
5561
uses: webispy/checkpatch-action@v9
5662
env:
@@ -71,9 +77,12 @@ jobs:
7177
contents: read
7278
pull-requests: read
7379
steps:
80+
- name: 'Calculate PR commits + 1'
81+
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> $GITHUB_ENV
7482
- uses: actions/checkout@v3
7583
with:
7684
ref: ${{ github.event.pull_request.head.sha }}
85+
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
7786
- name: Run checkpatch review
7887
uses: webispy/checkpatch-action@v9
7988
env:

0 commit comments

Comments
 (0)