Skip to content

core.setOutput not being recognized as property #104

@estokes-vs

Description

@estokes-vs

When using the following @actions/core package, I'm setting an output and then trying to reference it in a downstream action. The output is available and proper, but actionlint is throwing the following error which indicates that the only property of outputs that is available is results:

.github/workflows/ci.yml:21:33: property "color" is not defined in object type {result: string} [expression]

When calling ${{ steps.assign.outputs.results }} it doesn't return anything. I'm not sure if I'm doing something wrong or frowned upon with this mechanism, but wanted to open this issue to see if anyone else has ran into the problem?

Playground (which I think is awesome)

Code excerpt of how the setOutput command functions:
https://github.com/actions/toolkit/blob/27f76dfe1afb2b7e5e679cd8e97192d34d8320e6/packages/core/src/core.ts#L190

export function setOutput(name: string, value: any): void {
  process.stdout.write(os.EOL)
  issueCommand('set-output', {name}, value)
}

Github Action example:

jobs:
  test-workflow:
    name: color is cool
    runs-on: ubuntu-latest
    steps:
      - id: assign
        uses: actions/github-script@v5
        with:
          script: |
            core.setOutput('color', 'pink');
      - id: call
        run: |
          echo "color is ${{ steps.assign.outputs.color }}"

Screenshot of output being available and read successfully:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions