Skip to content

Inputs should be visible to hooks

Current situation

The inputs context is available in the if part of a hook definition, but not in its before or after sections:

hooks:
  - name: my hook
    events:
    - categoryPrefix: cucumber
      category: cucumber
    if: ('junit' in inputs.reporters) && (runner.os == 'windows')
    before:
    - run: echo hello windows
    - run: del foobar.html
    after:
    - run: echo ::attach::foobar.html
    - run: cleanup
      if: always()

Desired outcome

Hooks should be able to access the provider's parameters, using the inputs context, including in the before and after sections.

hooks:
  - name: my hook
    events:
    - categoryPrefix: cucumber
      category: cucumber
    if: ('junit' in inputs.reporters) && (runner.os == 'windows')
    before:
    - run: echo "About to run test ${{ inputs.test }} on windows"
    - run: del foobar.html
    after:
    - run: echo ::attach::foobar.html
    - run: cleanup
      if: always()

Basic inputs (strings, numbers, boolean) should also be available as environment variables (upper-cased, with the INPUT_ prefix, and - in their names replaced by underscore).

Edited by Martin Lafaix