Skip to content

Head_ref not found for PR's from forked repositories #694

Open
@grzegorzkrukowski

Description

@grzegorzkrukowski

I am trying to combine checkout with changed-files actions to get list of files that are changed in PR posted to our repository.

Currently I have:

- name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
 - name: Get changed files
      id: changed-files
      uses: tj-actions/changed-files@v14.3

The problem is that sometimes it includes changes coming from master branch into the changed files.

You can see runs here:
Wrong:
https://github.com/raycast/extensions/runs/5148147932?check_suite_focus=true#step:3:107

Right:
https://github.com/raycast/extensions/runs/5149182650?check_suite_focus=true#step:3:107

I tried solution described here:
#27 (comment)

but because my PRs are coming from forked repositories it doesn't work as shown here:
https://github.com/raycast/extensions/actions/runs/1833497844/attempts/1

It doesn't detect sha in case I do ref: ${{ github.head_ref }}.

Is there anything I am miss understanding here ? Is it due to PRs coming from forked repositories ?
Is there a way to make it work properly ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions