GitHub Action提示Unable to resolve action,能否回退Runner镜像版本?
问题描述
我配置的GitHub Action如下:
name: action-name on: workflow_dispatch jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-evaluation@v4 with: python-version: '3.11'
几天前"Set up job"环节运行正常,日志如下:
Current runner version: '2.311.0' Operating System Ubuntu 22.04.3 LTS Runner Image Image: ubuntu-22.04 Version: 20231030.2.0 Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20231030.2/images/linux/Ubuntu2204-Readme.md Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20231030.2 Runner Image Provisioner 2.0.312.1 GITHUB_TOKEN Permissions Contents: read Metadata: read Packages: read Secret source: Actions Prepare workflow directory Prepare all required actions Getting action download info Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744) Download action repository 'actions/setup-python@v4' (SHA:65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236) Complete job name: build
现在运行时出现错误,日志如下:
Current runner version: '2.311.0' Operating System Ubuntu 22.04.3 LTS Runner Image Image: ubuntu-22.04 Version: 20231115.7.0 Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20231115.7/images/ubuntu/Ubuntu2204-Readme.md Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20231115.7 Runner Image Provisioner 2.0.312.1 GITHUB_TOKEN Permissions Contents: read Metadata: read Packages: read Secret source: Actions Prepare workflow directory Prepare all required actions Getting action download info Error: Unable to resolve action actions/setup-evaluation, repository not found
目前仅发现Runner镜像版本变化,不清楚失败原因,请问能否回退到之前的镜像版本?
问题分析与解决方案
1. 根本错误原因
你配置的Action里写的是actions/setup-evaluation@v4,但这个仓库不存在——之前正常运行时,实际下载的是actions/setup-python@v4,说明这是手误写错了Action名称,和Runner镜像版本无关。
2. 直接修复方法
把错误的Action名称修正为正确的actions/setup-python@v4,修改后的Workflow如下:
name: action-name on: workflow_dispatch jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: '3.11'
3. 关于回退Runner镜像版本
虽然这次问题和镜像无关,但确实可以指定特定版本的Runner镜像。对于Ubuntu 22.04,你可以通过runs-on字段指定镜像版本,格式为ubuntu-22.04-<版本号>,比如你之前的版本写法如下:
jobs: build: runs-on: ubuntu-22.04-20231030.2.0
不过官方不建议长期固定旧镜像,因为旧镜像可能存在安全漏洞,修复Action名称才是解决当前问题的正确方式。
内容的提问来源于stack exchange,提问作者user680891
相关产品推荐
相关产品推荐

