Home > Net >  Github Actions: warning about set-output, but not using it
Github Actions: warning about set-output, but not using it

Time:01-25

I am using a GitHub actions to "build" a python app (running linting, code coverage, and tests). At the end of the action I get the following warning:

1 warning
build
The `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/

but my python-app.yml does not use set-output:

name: Python application

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Check out
      uses: actions/checkout@v3

    - name: Set up Python 3.10
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"

    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install pylint pytest pytest-cov
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

    - name: Lint with pylint
      run: |
        pylint src
      continue-on-error: false

    - name: Test with pytest
      run: |
        pytest
        
    - name: pytest coverage
      run:
        pytest --cov=./ --cov-report=xml:tests/coverage.xml
    - name: Upload coverage to Codecov
      uses: codecov/codecov-action@v3

and so I am not sure how to amend my .yml in order to make it compliant for the future.

CodePudding user response:

In your workflow, there may be indirect dependencies on actions that have yet not been updated for GITHUB_OUTPUT against the set-output deprecation.

You need to check all the actions in your workflow one by one for version updates with the set-output fix.

In your case, visiting https://github.com/actions/setup-python reveals that there's a new version available. And, searching for the set-output string in the repo results in relevant references e.g. issues, commit, etc. For example, this issue (https://github.com/actions/setup-python/issues/578) verifies that it has been fixed in @v4.

So, as of now, using @v4 should fix it i.e.:

- uses: actions/setup-python@v4

The actions are being updated gradually. Hopefully, all of them will be updated soon and we won't be seeing that warning anymore.

  • Related