action
action copied to clipboard
Error: undefined method `to_sym' when closing PR
Hi! Suddenly I'm just getting this error when I close a PR (without the pullpreview
label):
/app/lib/pull_preview/github_sync.rb:86:in `sync!': undefined method `to_sym' for nil:NilClass (NoMethodError)
from /app/lib/pull_preview/github_sync.rb:26:in `run'
from /app/bin/pullpreview:79:in `<main>'
I checked your repository and I can't see the problem
@chrisft25 is this still happening?
@chrisft25 is this still happening?
Yes @crohr , this is still happening every time we close or merge a PR
We're seeing the same whenever we try to build a pull preview via a Github label. The action fails to run. Happy to provide any additional info that would be useful!
+1 also having this problem
I'm seeing this on PRs that don't have the pullpreview
label. It makes an error show up in the PR, but isn't blocking. I think it's because GithubSync#guess_action_from_event
may not be handling all possible cases and is returning nil
. Perhaps that method should just return return :ignored
at the end to handle any missing cases?
I was seemingly able to work around this by adding if: github.event.label.name == 'pullpreview'
to the deploy job in the pullpreview.yml
workflow config file, but obviously it's not ideal.
@RyanNielson I'll push the fix you mention, but I'm curious: could you send me the content of your on:
section from your pullpreview workflow file?
And yes the filter on the label is necessary to avoid useless runs, for instance:
name: pullpreview
on:
schedule:
- cron: "30 0 * * *"
push:
branches:
- master
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened]
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'push' || github.event.label.name == 'pullpreview' || contains(github.event.pull_request.labels.*.name, 'pullpreview')
The fix is available in pullpreview/action@v5
. Can you retest and let me know if this fixes the issue?
@crohr Here ya go. Basically I only want to run on PRs with the pullpreview
label, and not run otherwise.
name: PullPreview
on:
pull_request:
types: [labeled, unlabeled, synchronize, closed, reopened, opened]
Also thanks for the quick turnaround on the fix, I'll see if I can try it sometime today.
And for some more context this is what we were seeing in PRs that weren't tagged with pullpreview
, and the error is related to PullPreview when you dig into it with the same exception message as this ticket was talking about.
@crohr I just did a quick check and it seems to have sorted out my team's issues. Thanks!