从PR更改集中删除特定文件

huangapple go评论129阅读模式
英文:

Remove certain files form PR change set

问题

我正在GitHub的工作流程中使用jitterbit/get-changed-files。我正在将这些更改传递到不同的测试中。但是,有时候我会得到一个PR,其中更改集包括我不想进行测试的文件。例如,src/third_party目录中的任何文件。有没有办法从更改集中删除这个目录?

这个工作流在一个自托管的Windows机器上运行。

name: 测试工作流

on:
  pull_request

jobs:
  build:
    runs-on: windows-latest 
    steps:
      uses: actions/checkout@v2 
       
       - id: changeset
         name: 获取PR更改集 
         uses: jitterbit/get-changed-files@v1

      - id: filtered-changeset
        name: 过滤更改集
        run: |
          # 我应该如何做到这一点??
英文:

I'm using jitterbit/get-changed-files as part of my workflow in GitHub. I'm taking this changeset and passing it through different tests. However, sometimes I get a PR in which the change set includes files I don't want to be tested. For example, anything in the src/third_party directory. Is there a way to remove this directory from the changeset?

The workflow runs on a self-hosted Windows machine.


name: Testing Workflow

on:
  pull_request

jobs:
  build:
    runs-on: windows-latest 
    steps:
      uses: actions/checkout@v2 
       
       - id: changeset
         name: Get PR Changeset 
         uses: jitterbit/get-changed-files@v1

      - id: filtered-changeset
        name: Filter the Changeset
        run: |
          # HOW DO I DO THIS??
 

</details>


# 答案1
**得分**: 2

链接: https://github.com/halaslabs/get-changed-files.

你应该可以使用 path-filters 输入选项来实现你想要的功能。

<details>
<summary>英文:</summary>

Funny enough, I forked that action so that I could filter the contents out of the resulting changed file list. 

See: https://github.com/halaslabs/get-changed-files.

You should be able to achieve what you are looking for with the path-filters input option.


```yml
jobs:
  build:
    runs-on: windows-latest 
    steps:
      - uses: actions/checkout@v3
      - name: Get Changed Files
        id: changeset
        uses: halaslabs/get-changed-files@v2
        with:
          path-filters: src/third_party/**

</details>



huangapple
  • 本文由 发表于 2023年4月7日 05:10:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953808.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定