Skip to content

Replace deprecated set-output command with environment file #1336

Open
@jongwooo

Description

@jongwooo

Describe the enhancement
In workflow, set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information, see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

Activity

paolorevillosa

paolorevillosa commented on Feb 22, 2023

@paolorevillosa

Does anyone find a fix for this?

jongwooo

jongwooo commented on Feb 22, 2023

@jongwooo
Author
jongwooo

jongwooo commented on Feb 22, 2023

@jongwooo
Author

@paolorevillosa Oh I just saw your comment #1218 , what I mentioned above was for workflow and I didn't find a solution for core.setOutput in actions/core. If I find a solution, I'll share it with you.

ghost
twohlix

twohlix commented on May 11, 2023

@twohlix

@ksaunders the code I'm reading only does it one of the ways. But it keeps running it the old way for one of my actions. Code I'm seeing 1.10.0:

export function setOutput(name: string, value: any): void {
  const filePath = process.env['GITHUB_OUTPUT'] || ''
  if (filePath) {
    return issueFileCommand('OUTPUT', prepareKeyValueMessage(name, value))
  }

  process.stdout.write(os.EOL)
  issueCommand('set-output', {name}, toCommandValue(value))
}

so if process.env['GITHUB_OUTPUT'] is empty it does it the old way with issueCommand('set-output']), but if its not empty it does it the new way.

One of my actions must be evaluating process.env['GITHUB_OUTPUT'] to empty as I'm using actions/core 1.10.0 and still getting the set-output warning.

Seems frustrating that the library which we're supposed to use will sometimes try it in a deprecated way. I'm also pretty bad at debugging github actions so I'm drawing a blank why my action would evaluate the GITHUB_OUTPUT as not there?

rentziass

rentziass commented on May 19, 2023

@rentziass
Member

Hey @twohlix 👋 you're correct in that old behaviour is still present in actions/core for backwards compatibility reasons. Runner should be setting GITHUB_OUTPUT in your jobs, would you able to please validate the env variable is there and is not being unset/overwritten? You should only get a warning if one of this is true:

  • actions/core < 1.10.0
  • GITHUB_OUTPUT is not set
  • something is issuing the command using STDOUT (i.e. echo "::set-output name={name}::{value}")

Does your action have any other dependencies that could affect this? Also if your action is public I'd be happy to have a look :)

ghost
ghost

8 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @atoomic@twohlix@rentziass@paolorevillosa@jongwooo

      Issue actions

        Replace deprecated `set-output` command with environment file · Issue #1336 · actions/toolkit