Github Actions:关于 set-output 的警告,但不使用它

Rob*_*der 4 github github-actions

我正在使用 GitHub 操作“构建”Python 应用程序(运行 linting、代码覆盖率和测试)。在操作结束时,我收到以下警告:

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/
Run Code Online (Sandbox Code Playgroud)

但我的python-app.yml不使用 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
Run Code Online (Sandbox Code Playgroud)

所以我不知道如何修改我的.yml以使其符合未来的要求。

Aze*_*eem 7

在您的工作流程中,可能存在对尚未针对deprecation更新GITHUB_OUTPUT的操作的间接依赖性。set-output

您需要一一检查工作流程中的所有操作,以了解修复后的版本更新set-output

就您而言,访问https://github.com/actions/setup-python显示有新版本可用。set-output并且,在存储库中搜索字符串会导致相关引用,例如问题、提交等。例如,此问题( https://github.com/actions/setup-python/issues/578)验证它是否已修复在@v4

所以,到目前为止,使用@v4应该可以修复它,即:

- uses: actions/setup-python@v4
Run Code Online (Sandbox Code Playgroud)

动作正在逐步更新。希望所有这些都将很快更新,我们不会再看到该警告。