trilom / file-changes-action

This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.
MIT License
167 stars 48 forks source link

Problem running action: "Received event from workflow_dispatch, but received no inputs" error message #117

Open AbianG opened 3 years ago

AbianG commented 3 years ago

I'm trying to run the action as part of a test pipeline (to see if it helps with a project) but the problem is that, following the readme examples, I cannot make it run correctly. The test pipeline code is:

name: "xml-lint-TEST"

on:
  pull_request:
    branches:
      - master
      - dev
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v2

    - name: Detect changed xml files
      uses: trilom/file-changes-action@v1.2.3
      with:
        githubToken: ${{ secrets.GITHUB_TOKEN }}
        plaintext: true
    - name: Echo file changes
      run: | 
        echo Changed files: ${{ steps.get_file_changes.outputs.files }} 

Problem is, it fails with the following error:

Warning: Unexpected input(s) 'plaintext', valid inputs are ['githubRepo', 'githubToken', 'pushBefore', 'pushAfter', 'prNumber', 'output', 'fileOutput']
Run trilom/file-changes-action@v1.2.3
(node:2611) UnhandledPromiseRejectionWarning: Error: {"error":"500/inferInput Error","from":"inferInput","message":"Received event from workflow_dispatch, but received no inputs. {event_name:workflow_dispatch, pr: NaN, before:false, after:false}","payload":""}
    at run (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:19989)
    at Object.198 (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:20067)
    at __webpack_require__ (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:154)
    at startup (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:291)
    at module.exports.0 (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:323)
    at Object.<anonymous> (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:333)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
(node:2611) 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:2611) [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.
Error: There was an issue inferring inputs to the action.
Exception: {
  "error": "500/inferInput Error",
  "from": "inferInput",
  "message": "Received event from workflow_dispatch, but received no inputs. {event_name:workflow_dispatch, pr: NaN, before:false, after:false}",
  "payload": ""
}

I do not understand fully the error, but fearing it might have something to do with the plaintext: true statement, I removed it along with githubToken: ${{ secrets.GITHUB_TOKEN }} (all under the with: really) and reran it, still got an error about input (this time about infering input)

  with:
    githubToken: ***
    output: json
    fileOutput: json
Error: There was an issue inferring inputs to the action.
Exception: {
  "error": "500/inferInput Error",
  "from": "inferInput",
  "message": "Received event from workflow_dispatch, but received no inputs. {event_name:workflow_dispatch, pr: NaN, before:false, after:false}",
  "payload": ""
}
(node:2570) UnhandledPromiseRejectionWarning: Error: {"error":"500/inferInput Error","from":"inferInput","message":"Received event from workflow_dispatch, but received no inputs. {event_name:workflow_dispatch, pr: NaN, before:false, after:false}","payload":""}
    at run (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:19989)
    at Object.198 (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:20067)
    at __webpack_require__ (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:154)
    at startup (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:291)
    at module.exports.0 (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:323)
    at Object.<anonymous> (/home/runner/work/_actions/trilom/file-changes-action/v1.2.3/dist/index.js:1:333)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
(node:2570) 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:2570) [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.

I am not sure of where should I start, as the pipeline is extremely simple at this point and based on the documentation. Any help will be welcome.

rob-metalinkage commented 3 years ago

Seems to be a bug if workflow_dispatch used to trigger this? I have same problem.

808sAndBR commented 2 years ago

I was able to overcome this issue by passing the PR manually using https://github.com/marketplace/actions/find-pull-request . I think it is because workflow_dispatch is set on branches not PRs (I ended up abandoning this approach anyways since workflow dispatch could not update the PR of its test status anyways :( )

      - name: Find Pull Request
        uses: juliangruber/find-pull-request-action@v1
        id: find-pull-request
        with:
          branch: ${{github.ref_name}}

      - name: Get changed files
        id: get_file_changes
        uses: trilom/file-changes-action@v1.2.4
        with:
          output: ' '
          prNumber: ${{ steps.find-pull-request.outputs.number }}