在GitHub动作中检索已修改文件的列表

时间:2019-12-11 15:21:46

标签: github github-actions

我是GitHub操作的新手,目前正在使用https://github.com/foo-software/lighthouse-check-action自动执行审核。但是由于必须urls进行硬编码,因此在只审核提交中的已修改页面而基于这些页面而失败时,并没有证明它有用。

在我完全缺少某些东西的情况下,有没有办法实现上述目标?我正在查看类似https://github.com/marketplace/actions/get-changed-files之类的操作,但无法正常工作。我还查看了GitHub事件和参考文档,但无法弄清这些内容。有人会指出我正确的方向吗?

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

lots0logs/gh-action-get-changed-files操作由于this错误而中断了atm。看一下jitterbit/get-changed-files动作。它非常适合我:

.github / workflows / test.yml

name: Test

on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2.1.0
      - uses: jitterbit/get-changed-files@v1
        id: abc
        with:
          format: space-delimited
          token: ${{ secrets.GITHUB_TOKEN }}
      - name: Printing
        run: |
          echo "All:"
          echo "${{ steps.abc.outputs.all }}"
          echo "Added:"
          echo "${{ steps.abc.outputs.added }}"
          echo "Removed:"
          echo "${{ steps.abc.outputs.removed }}"
          echo "Renamed:"
          echo "${{ steps.abc.outputs.renamed }}"
          echo "Modified:"
          echo "${{ steps.abc.outputs.modified }}"
          echo "Added+Modified:"
          echo "${{ steps.abc.outputs.added_modified }}"

日志输出:

2020-05-15T13:47:15.5267496Z All:
2020-05-15T13:47:15.5268424Z .github/workflows/test.yml .tidy-renamed2 Test.ts hello.py
2020-05-15T13:47:15.5268537Z Added:
2020-05-15T13:47:15.5268609Z hello.py
2020-05-15T13:47:15.5268697Z Removed:
2020-05-15T13:47:15.5268787Z Test.ts
2020-05-15T13:47:15.5268880Z Renamed:
2020-05-15T13:47:15.5269260Z .tidy-renamed2
2020-05-15T13:47:15.5269357Z Modified:
2020-05-15T13:47:15.5269450Z .github/workflows/test.yml
2020-05-15T13:47:15.5269547Z Added+Modified:
2020-05-15T13:47:15.5269625Z .github/workflows/test.yml hello.py
2020-05-15T13:47:15.5306656Z Post job cleanup.