浏览代码

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

Signed-off-by: Zhouqi Jiang <luojia@hust.edu.cn>
Zhouqi Jiang 2 月之前
父节点
当前提交
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