request-action icon indicating copy to clipboard operation
request-action copied to clipboard

[Blocked] Warnings about unexpected inputs

Open dgholz opened this issue 4 years ago • 26 comments

Hello, I have a step in my workflow like:

      - name: Get count of commits ahead of merge base
        id: github_compare
        uses: octokit/[email protected]
        with:
          route: GET /repos/:repository/compare/:base...:head
          repository: ${{ github.repository }}
          base: ${{ github.base_ref }}
          head: ${{ github.ref }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

When the workflow runs, I see Annotations about unexpected inputs, and in the workflow output, I see:

##[warning]Unexpected input 'repository', valid inputs are ['route', 'mediaType']
##[warning]Unexpected input 'base', valid inputs are ['route', 'mediaType']
##[warning]Unexpected input 'head', valid inputs are ['route', 'mediaType']
Run octokit/[email protected]
  with:
    route: GET /repos/:repository/compare/:base...:head
    repository: dgholz/my_repo
    base: master
    head: refs/pull/1/merge
    mediaType: {}
  env:
    GITHUB_TOKEN: ***
GET /repos/:repository/compare/:base...:head
> repository: dgholz/my_repo
> base: master
> head: refs/pull/1/merge
> mediaType: [object Object]
< 200 451ms

How do I prevent these warnings from appearing?

dgholz avatar May 25 '20 16:05 dgholz

Unfortunately there is no way to prevent these warnings, it looks like they are a recent change in the GitHub Actions runner. All inputs that are not defined in the action.yml file now trigger this warning, and there is no flag to suppress them at this point 😭

I'll reach out to support and ask about it, we can leave the issue open for the time being

gr2m avatar May 26 '20 17:05 gr2m

:wave: I've received a report from users of an action I maintain with similar warnings.

In my case I define an input as a pattern rather than a static name to support user defined named sets of files included in a diff . The current action.yml file descriptor lacks an ability to express input names as patterns. Since inputs are just a conventionally named env variable in thier implementation I can have users just declare INPUT_ env names instead. That feels less than ideal for an interface.

Is there any other way to suppress these on an per-action level? I understand why GitHub might have added these warnings. In my case, it makes a working action look broken.

softprops avatar Jun 06 '20 21:06 softprops

make sure to contact support at support.github.com/contact to let them know about your use case. It will bump the priority. And the more use cases there are, the better. I have hope that a setting to suppress these warnings will be added, the sooner the better :)

gr2m avatar Jun 06 '20 23:06 gr2m

@gr2m thanks! Any ETA?

junghans avatar Jun 17 '20 17:06 junghans

Nothing that I heard. Did you check in with support? I think they are aware of the problem, but I'm not sure what the current state is, i have no insights myself.

gr2m avatar Jun 17 '20 18:06 gr2m

One issue is that the README in this repository suggests using the repository key, which raises this warning. Perhaps as an interim solution the README can be updated to note that this warning will be present but everything works as expected?

bryanwweber avatar Jul 21 '20 15:07 bryanwweber

Very good idea! Would you like to send a PR?

gr2m avatar Jul 21 '20 15:07 gr2m

@gr2m: Where is the actions.yml? Is it part of this repo, or the one that uses octokit/request-action?

tillkruss avatar Mar 22 '21 17:03 tillkruss

The one in this repository: https://github.com/octokit/request-action/blob/master/action.yml

gr2m avatar Mar 22 '21 18:03 gr2m

@gr2m: Can I open a PR with two dozen common input names to avoid the most frequent warnings?

tillkruss avatar Mar 22 '21 22:03 tillkruss

sure, thank you!

I was expecting GitHub to fix that swiftly but looks like it got lost in the backlog.

gr2m avatar Mar 22 '21 22:03 gr2m

also if you could reach out to https://support.github.com/contact as well that'd be helpful, it will prioritize the request to add some kind of flag to suppress warnings for undefined parameters

gr2m avatar Mar 22 '21 22:03 gr2m

There is an open issue on the actions runner repository to address this problem: https://github.com/actions/runner/issues/514

The runner is open source and written in C#, I'm sure they'd accept a good PR. It's not something the actions team has currently on their roadmap.

gr2m avatar Apr 22 '21 20:04 gr2m

Any traction on above Warnings issue?

I had a jackpot moment when I came across this action as it would save me on wrapping octokit steps in JavaScript (@actions/github-script), however those pesky warning Annotations are unpresentable to developers/business in a professional setting making every workflow look broken :-/

spol-vt avatar Sep 24 '21 10:09 spol-vt

Can you reach out to support to bump the priority for getting this fixed? It’s been so long since there has been any movement in this :(

gr2m avatar Sep 24 '21 15:09 gr2m

+1

razbensimon avatar Sep 26 '21 10:09 razbensimon

+1

kakuzei avatar Oct 15 '21 12:10 kakuzei

As a workaround you can pass inputs as env variables as follows:

      - name: Get count of commits ahead of merge base
        id: github_compare
        uses: octokit/[email protected]
        with:
          route: GET /repos/:repository/compare/:base...:head
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          INPUT_REPOSITORY: ${{ github.repository }}
          INPUT_BASE: ${{ github.base_ref }}
          INPUT_HEAD: ${{ github.ref }}

cardinalby avatar Dec 17 '21 19:12 cardinalby

@cardinalby thank you. Can you say me what is the solution for issues?

I use this:

      - name: Issues
        uses: octokit/[email protected]
        id: myissues
        with:
          route: GET /search/issues
          q: 'repo:${{ env.myrepo }} milestone:"${{ env.mymilestone }}" label:"Bugfix","Label 1",Label 2"'
          per_page: 100
        env:
          GITHUB_TOKEN: ${{ .... }}

If I do the same first without env variabeln I get no more results

      - name: Issues
        uses: octokit/[email protected]
        id: myissues
        with:
          route: GET /search/issues?q=repo:MYREPO
        env:
          GITHUB_TOKEN: ${{ .... }}

KodaCHC avatar Feb 16 '22 10:02 KodaCHC

@KodaCHC It seems to be unrelated to this issue. The library may not allow query parameters in a route (but expects them in as separate params, as you showed in the first example). Back to the issue, try passing them as INPUT_Q and INPUT_PER_PAGE env variables if you want to avoid warnings.

cardinalby avatar Feb 16 '22 16:02 cardinalby

Danke Thanks for the answer. How do I specify q without listing it under with?

KodaCHC avatar Feb 16 '22 19:02 KodaCHC

See my initial answer, you can pass INPUT_Q env variable in env: section. It will work as if you set q input

cardinalby avatar Feb 16 '22 19:02 cardinalby

Thank you. I misunderstood that. This works really well.

KodaCHC avatar Feb 17 '22 05:02 KodaCHC

Lint code base Unexpected input(s) 'auto_fix', valid inputs are ['entryPoint', 'args']

How can I Correct this and run the auto fix in the linter.

sasankaweera123 avatar Mar 16 '23 04:03 sasankaweera123

Shouldn't it be possible to have only a single variables input, that accepts an object with the custom keys? That one inut can be defined and wouldn't throw the warning. Only issue is, that GitHub doesn't seem to support maps as input values directly, so the action would need to parse them, and in the config we would need to JSON stringify the object before passing it to the action.

https://stackoverflow.com/a/67058647

adrianjost avatar Jan 31 '24 12:01 adrianjost

I'm not sure if we implemented it for the action, but the underlying Octokit supports data for that, so you might be able to use it, just make sure you pass it as string

  data: |
    owner: ...
    repo: ...
    # etc 

I think it's less elegant though

gr2m avatar Feb 01 '24 18:02 gr2m