xt0rted / pull-request-comment-branch

A GitHub Action to get the head ref and sha of a pull request comment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conditionally fail action

jetersen opened this issue · comments

would be nice to avoid failing the action.

I have workflow that deploys artifacts on pull request comment and on master branch pushes.

on:
  push:
    branches:
      - 'master'
  issue_comment:
    types:
      - created

The action does not fail gracefully when run on none PR comment:

Error: Variable $number of type Int! was provided invalid value
(node:1812) UnhandledPromiseRejectionWarning: GraphqlError: Variable $number of type Int! was provided invalid value
    at /home/runner/work/_actions/xt0rted/pull-request-comment-branch/v1/webpack:/pull-request-comment-branch/node_modules/@octokit/graphql/dist-node/index.js:56:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1812) UnhandledPromiseRejectionWarning: HttpError: Not Found
    at /home/runner/work/_actions/xt0rted/pull-request-comment-branch/v1/webpack:/pull-request-comment-branch/node_modules/@octokit/request/dist-node/index.js:66:1
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:1812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

you can slap a if: ${{ github.event.issue.pull_request }} on there