# GitHub Actions: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files

**Code:** `set-output command is deprecated` · **Category:** CI/CD · **Seen on:** GitHub Actions

Workflows (or old actions) still use `::set-output`, which must be replaced by writing to the `$GITHUB_OUTPUT` file.

## Meaning

The old workflow commands were insecure. Replace `echo "::set-output name=x::y"` with `echo "x=y" >> "$GITHUB_OUTPUT"`. The same applies to `save-state` (`$GITHUB_STATE`). If a third-party action triggers the warning, update that action.

## Common causes

- `echo "::set-output name=...::..."` in your scripts
- Old versions of actions that use the toolkit's `setOutput`
- Copy-pasted snippet from an older tutorial
- `save-state` used the same way

## Quick fix

1. Write outputs with `echo "name=value" >> "$GITHUB_OUTPUT"`
2. Update the action named in the warning
3. Search the repo: `grep -R "::set-output" .github`

## Detailed fix by platform

### GitHub Actions

1. Multi-line output: `{ echo 'body<<EOF'; cat file.txt; echo EOF; } >> "$GITHUB_OUTPUT"`

## Code examples

### New syntax

```yaml
- id: ver
  run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"      # was ::set-output name=version::...
- run: echo "Building ${{ steps.ver.outputs.version }}"
```

## How to diagnose

1. **Source** — Your script or an action?
2. **Version** — Latest version of that action?
3. **Search** — grep for ::set-output

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cicd/gha-set-output-deprecated)
