Home > OS >  Inputs with same name getting problems in Github Actions
Inputs with same name getting problems in Github Actions

Time:03-14

I have this Github Action that uses two different action in the same job:

name: My workflow

on:
    workflow_dispatch:

jobs:
  my-workflow:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-go@v2
        with:
          go-version: 1.17

      - name: X Action
        uses: x-action/x-action@main
        with:
          file: x-action.txt

      - name: Y Action
        uses: y-action/y-action@main
        with:
          file: y-action.txt

The two inputs file cause a problem because Github Actions just consider the first one. Looking inside the composite of Action, they use ${{inputs.<inputs_name>}}.

I think this is a big problem because a lot of actions use some defaults names in inputs like output, path, key.

Maybe there is another way to specify ${{inputs.<inputs_name>}}, but I don't know.

CodePudding user response:

It's not gonna be the problem at all.

Composite action has their own inputs scope. The only thing you need to take care of is to use ${{ inputs.file }} inside the composite actions, not the global github.inputs.file - and it will be just all fine.

  • Related