Closed reetika-roy closed 1 year ago
That would happen with an empty body. It can't read anything from it if it's empty. Maybe it should issue a better message?
I am seeing a better error today.
The body of the PR is empty, can't check
Was that the same version?
Yup the same version.
If possible, please give me in the future the whole log; that way, I can try and find where it failed. Anyway, I'm happy it's working for you now. Thanks for the report!
Re-opening this because I am definitely seeing this even when the body is not empty
Checking body contents
Error: ❌ TypeError: Cannot read properties of undefined (reading 'body')
at /home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/lib/main.js:53:1
at Generator.next (<anonymous>)
at /home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/lib/main.js:31:1
at new Promise (<anonymous>)
at __webpack_modules__.3109.__awaiter (/home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/lib/main.js:2[7](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:8):1)
at run (/home/runner/work/_actions/JJ/github-pr-contains-action/releases/v[9](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:10)/webpack:/github-pr-contains-action/lib/main.js:43:1)
at Object.3[10](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:11)9 (/home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/lib/main.js:[12](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:13)9:1)
at __nccwpck_require__ (/home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/webpack/bootstrap:21:1)
at /home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/webpack:/github-pr-contains-action/webpack/startup:4:1
at Object.<anonymous> (/home/runner/work/_actions/JJ/github-pr-contains-action/releases/v9/dist/index.js:[16](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:17)[17](https://github.com/truera/truera/actions/runs/4166493054/jobs/7211277068#step:2:18)0:12)
What other logs can I help with?
This will make do for the time being, thanks... Still a private repository, right?
Yes. It was definitely working some time too. Seems flaky.
I have pushed a new version to master, which I think has a finer distinction between different types of "empty". Can you please check and report back?
I will check with this- but in the cases I saw the error, the PR did have a description. So I do not follow how this might help.
I will check with this- but in the cases I saw the error, the PR did have a description. So I do not follow how this might help.
To be honest, I'm not sure either. But the error says clearly there's no "body", so that's what I'm working with...
I'm having this exact same issue: https://github.com/Kareadita/Kavita/pull/1886
Body is indeed there, token works as it's used in my pipeline elsewhere.
jobs:
check_pr:
runs-on: ubuntu-latest
steps:
- name: Check PR Body
uses: JJ/github-pr-contains-action@releases/v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
bodyDoesNotContain: "[\"|`]"
OK, will check. Thanks for your report.
@majora2007 I see you have already upgraded to version 9 here will take a look.
OK, I think I know what's the problem. The problem is that PRs have two different kind of events. The initial pull_request
event includes a body and a diff; however, subsequent push
events in the same PR do not have a pull_request
payload.
That's going to need some refactoring, I'm afraid, so it will take some time. I'll try to get around to it next week.
Does that seem to be the problem here, would you say?
That makes a lot of sense. No rush, I appreciate you taking the time to enhance your software.
I think your assessment is right- I have not seen the issue since I removed push
events from my trigger condition.
Just released version 10 should fix, or rather work around, the problem. Can you please check? I'll reopen if it does not.
I have indeed check, and it works! Thanks again JJ.
I have a workflow that runs for a private repository- I am using
releases/v9
for it. I see the following errorI was working with
master
earlier and that did not have this issue.