github-pr-resource icon indicating copy to clipboard operation
github-pr-resource copied to clipboard

get list_changed_files does not appear in .git/resources/

Open djcal460 opened this issue 4 years ago • 2 comments

When get my pr resource and set the params for list_changed_files: true this does not create a directory as stated in the documentation. For example,

  - get: git-pr
    trigger: true
    version: every
    params:
      list_changed_files: true

After I get the pr resource and put it into pending, I then pass the resource to a task and run a script:

  - task: find_input
    input_mapping:
      source-repo: git-pr
    config:
       ...
      inputs:
        - name: source-repo
      outputs:
        - name: dest-repo
      run:
        path: sh
        args:
          - -exc
          - |
            ls -la source-repo/.git/resource/  >> dest-repo/new_output.txt

Later in the output task, I cat dest-repo/new_output.txt. I do not see .git/resources/changed_files listed. Only the following:

Nov 17 18:41 . Nov 17 18:41 .. Nov 17 18:41 author Nov 17 18:41 author_email Nov 17 18:41 base_name Nov 17 18:41 base_sha Nov 17 18:41 head_name Nov 17 18:41 head_sha Nov 17 18:41 message Nov 17 18:41 metadata.json Nov 17 18:41 pr Nov 17 18:41 state Nov 17 18:41 title Nov 17 18:41 url Nov 17 18:41 version.json

Is this a bug or am I doing anything wrong? Thanks in advance!

djcal460 avatar Nov 17 '21 20:11 djcal460

@djcal460 I had this same issue and took a while to figure out what was going on. The issue here is the implicit get done when you put the resource to set the status wipes out the previous metadata files for subsequent tasks. What I ended up doing in a similar situation was something like this:

- get: ci
  trigger: true
  version: every

- put: ci
  params:
    path: ci
    context: validation
    status: pending
  get_params:
    list_changed_files: true

- task: foo
...

Using list_changed_files in the put step instead of the get seemed to solve this problem.

EdgeJ avatar Apr 07 '22 13:04 EdgeJ