Просмотр исходного кода

fix(workflow): print authors' information usign HEAD~1 on commit pushes

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
Zhouqi Jiang 2 месяцев назад
Родитель
Сommit
65e20b91cf
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      .github/workflows/DCO.yml

+ 7 - 1
.github/workflows/DCO.yml

@@ -71,4 +71,10 @@ jobs:
 
       - name: Print authors' information
         run: |
-          git log --pretty="format:%h - %an <%ae> [%G?]" ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
+          if [ -n "$GITHUB_BASE_REF" ]; then
+            git fetch origin $GITHUB_BASE_REF
+            RANGE="origin/$GITHUB_BASE_REF..HEAD"
+          else
+            RANGE="HEAD~1..HEAD"
+          fi
+          git log --pretty="format:%h - %an <%ae> [%G?]" $RANGE