changed-files
changed-files copied to clipboard
[error]Could not get pull request from context, exiting
Hi @futuratrepadeira ! Thanks for this nifty action. I'm running into this issue.
My workflow looks like this:
- name: Changed Files Exporter
id: get_file_changes
uses: futuratrepadeira/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pattern: '^.*\.(ts|tsx)$'
Inspecting the code, I see it failing at the below line.
https://github.com/futuratrepadeira/changed-files/blob/ca328ebf8ca65f94258677cea8478f0094d76a8e/src/main.ts#L100
What could be a possible reason? Can I debug this locally?
Let me know if you need more debug info.
Hi @ravikp7, can you tell me on what event you're using the action? If you're not using it with pull_request
events, then you have to specify the pr-number
input.
Hi @ravikp7, can you tell me on what event you're using the action? If you're not using it with
pull_request
events, then you have to specify thepr-number
input.
I'm using it for the pull_request event
Hum.. that means accessing github.context.payload.pull_request
resulted in an undefined value. The event is supposed to be stored in workflow/event.json
/GITHUB_EVENT_PATH
. Can your action be doing something that changes this?
Maybe this changed at some point, in which case I would recommend you try to run the action at v3.3.0. Unfortunately, there's no good way to debug this issue locally :/
I see the same issue with v3.3.0 when using
- name: Changed Files Exporter
id: changed-files
uses: futuratrepadeira/[email protected]
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
pattern: '^.*\.(md|markdown)$'
result-encoding: 'string'
The error I get looks like the following:
Run futuratrepadeira/[email protected]
with:
repo-token: ***
pattern: ^.*\.(md|markdown)$
result-encoding: string
Error: Could not get pull request from context, exiting
According to https://github.com/actions/checkout/issues/136, I also tried to set
- uses: actions/checkout@v2
with:
ref: main
a the checkout step I run before.
@aheil is this something that happened once, or happens frequently? If the former, is anything special about that PR that you can think of?
It happens frequently, I just tried another Action were I also have to pass the GITHUB_TOKEN.
Haven't changed anything else. I do not encounter any problems then.
If I can prived any further information, please let me know.
I get the error if my config includes the push:
on:
pull_request:
branches:
- develop
paths:
- '**.py'
push:
paths:
- '**.py'
No error for pull_request event. Would it be possible to add support for just pushes?
There's currently some support for push: you can specify the pr-number
input. Adding native support for push shouldn't be too hard.