【问题标题】:How to get file names of files updated by commit in GitHub Actions?如何在 GitHub Actions 中获取提交更新的文件的文件名?
【发布时间】:2021-01-24 06:07:23
【问题描述】:

在 GitHub Actions 工作流程中,我们多次尝试使用此命令 run: git diff-tree --no-commit-id --name-only -r ${{ github.sha }} 获取由推送提交更改的文件的文件名。但它总是只返回以下日志,没有给出文件名或带路径的文件名。见下图。

关于 Runner 类型ubuntu-latest,它不是自托管的 runner。

【问题讨论】:

    标签: git github github-actions


    【解决方案1】:

    默认情况下,结帐操作会创建一个浅层克隆。使用

      - uses: actions/checkout@v2
        with:
          # Number of commits to fetch. 0 indicates all history for all branches and tags.
          # Default: 1
          fetch-depth: 2
    

    来源:https://github.com/actions/checkout#usage

    【讨论】:

      猜你喜欢
      • 2022-01-02
      • 2022-06-16
      • 2022-07-23
      • 2021-09-30
      • 1970-01-01
      • 1970-01-01
      • 2020-09-07
      • 2022-01-22
      相关资源
      最近更新 更多