Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support event: 'workflow_dispatch' #926

Closed
Nightblade opened this issue Aug 27, 2022 · 6 comments · Fixed by #927 or #928
Closed

Support event: 'workflow_dispatch' #926

Nightblade opened this issue Aug 27, 2022 · 6 comments · Fixed by #927 or #928
Labels
enhancement New feature or request

Comments

@Nightblade
Copy link

Error message: Unsupported event: 'workflow_dispatch'

2022-08-27T07:20:25.3050870Z ##[group]Run streetsidesoftware/cspell-action@v2.4.0
2022-08-27T07:20:25.3051331Z with:
2022-08-27T07:20:25.3051534Z   files: **
2022-08-27T07:20:25.3051773Z   config: cspell.json
2022-08-27T07:20:25.3052189Z   github_token: ***
2022-08-27T07:20:25.3052455Z   incremental_files_only: true
2022-08-27T07:20:25.3052826Z   inline: warning
2022-08-27T07:20:25.3053040Z   strict: true
2022-08-27T07:20:25.3053423Z env:
2022-08-27T07:20:25.3053767Z   CONFIG_URL: https://raw.githubusercontent.com/Nightblade/pob-dict/main
2022-08-27T07:20:25.3054128Z ##[endgroup]
2022-08-27T07:20:25.6528976Z cspell-action
2022-08-27T07:20:25.6635716Z AppError: Unsupported event: 'workflow_dispatch'
2022-08-27T07:20:25.6636742Z     at action (/home/runner/work/_actions/streetsidesoftware/cspell-action/v2.4.0/action/lib/action.js:214:15)
2022-08-27T07:20:25.6638101Z     at run (/home/runner/work/_actions/streetsidesoftware/cspell-action/v2.4.0/action/lib/main.js:47:35)
2022-08-27T07:20:25.6639663Z     at Object.<anonymous> (/home/runner/work/_actions/streetsidesoftware/cspell-action/v2.4.0/action/lib/main_root.js:4:12)
2022-08-27T07:20:25.6640248Z     at Module._compile (node:internal/modules/cjs/loader:1101:14)
2022-08-27T07:20:25.6640657Z     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
2022-08-27T07:20:25.6641079Z     at Module.load (node:internal/modules/cjs/loader:981:32)
2022-08-27T07:20:25.6641478Z     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
2022-08-27T07:20:25.6641934Z     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
2022-08-27T07:20:25.6642357Z     at node:internal/main/run_main_module:17:47
2022-08-27T07:20:25.6676515Z ##[error]Unsupported event: 'workflow_dispatch'

Action was called with workflow_dispatch input 4981 using the following workflow file:

name: 'test_cspell_pull_request'

on:
  workflow_dispatch:
    inputs:
      pr_num:
        description: Pull Request Number (optional)
        required: false

jobs:

  spelling:
    runs-on: ubuntu-latest
    env: 
      CONFIG_URL:  https://raw.githubusercontent.com/Nightblade/pob-dict/main
    steps:

      - name: Checkout
        uses: actions/checkout@v3
        if: ${{ inputs.pr_num == '' }}

      - name: Get PR #${{ inputs.pr_num }}
        if: ${{ inputs.pr_num != '' }}
        uses: actions/checkout@v3
        with:
          ref: "refs/pull/${{ inputs.pr_num }}/head"
          repository: PathOfBuildingCommunity/PathOfBuilding
          fetch-depth: 0

      - name: Fetch config file and dictionaries
        run: |
          curl --silent --show-error --parallel --remote-name-all \
            ${{ env.CONFIG_URL }}/cspell.json \
            ${{ env.CONFIG_URL }}/pob-dict.txt \
            ${{ env.CONFIG_URL }}/poe-dict.txt \
            ${{ env.CONFIG_URL }}/ignore-dict.txt
      - name: Run cspell
        uses: streetsidesoftware/cspell-action@v2.4.0
        with:
          files: '**'
          config: "cspell.json"
@Jason3S Jason3S added the enhancement New feature or request label Aug 27, 2022
@Jason3S Jason3S changed the title bug: Unsupported event: 'workflow_dispatch' Supported event: 'workflow_dispatch' Aug 27, 2022
@Nightblade Nightblade changed the title Supported event: 'workflow_dispatch' Support event: 'workflow_dispatch' Aug 29, 2022
@Jason3S
Copy link
Contributor

Jason3S commented Aug 29, 2022

@Nightblade,

workflow_dispatch is supported, just not with incremental_files_only: true.

I'll adjust the code so that it will check ALL files when run manually even if incremental_files_only is true.

Jason3S added a commit that referenced this issue Aug 29, 2022
Jason3S added a commit that referenced this issue Aug 29, 2022
* fix: Handle non-incremental workflows

fix: #926
@Nightblade
Copy link
Author

Don't I need incremental_files_only though with PRs to prevent checking of the entire repo? Or do I misunderstand? (Lots of brain fog ATM)

@Jason3S
Copy link
Contributor

Jason3S commented Aug 29, 2022

@Nightblade,

incremental_files_only is used to only check the changed files.

But with workflow_dispatch the action doesn't know what has been changed. So it used to just give up with an error.

I have changed it to check all files specified with files when workflow_dispatch is used.

@Nightblade
Copy link
Author

Nightblade commented Aug 30, 2022

But with workflow_dispatch the action doesn't know what has been changed.

Please help me understand why? Perhaps I can find a work-around. :)

@Jason3S
Copy link
Contributor

Jason3S commented Aug 30, 2022

@Nightblade,

When using incremental_files_only, the action sends a request to GitHub for the list of commits. From the list of commits, it builds a list of files to check.

It uses these APIs:

A push workflow context contains the list of commits.
A pull_request workflow context contains the PR which is used to get the list of commits.

In a workflow_dispatch context, there isn't enough information to retrieve the list of files.

It is possible to enhance the action to accept a PR# so it can attempt to do the same thing as a PR event.

@Nightblade
Copy link
Author

I'll have a look at those, thanks for being so helpful and patient!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants