actions / actions/toolkit

core.getInput (and maybe other things) doesn't work in another action

Open
#1,124 14 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core question
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Please let me know if I'm just doing things wrong, but when actions/github-script is used within another action, things like core.getInput('some_input) don't return anything.

I have a test here to demonstrate: https://github.com/daleyjem/test-github-script/pull/1

Workflow File

name: Test
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  test:
    name: test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Test input
        uses: ./.github/actions/test-input

Action File

name: Test Input
description: Test input
inputs:
  my_input: 
    description: My input
    required: false
    default: 'foobar'

runs:
  using: 'composite'
  steps:
    - name: Log input val
      uses: actions/github-script@v6
      with:
        script: |
          console.log('my_input =', core.getInput('my_input'))
    - name: Log it the other way
      run: |
        echo ${{ inputs.my_input }}
      shell: bash

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction, especially its workflow file and .github/actions/test-input composite action, then compare core.getInput('my_input') with ${{ inputs.my_input }}. Done means determining whether composite-action inputs should be available to the nested actions/github-script step and adding a regression test or documenting the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.