Github Actions错误:找不到操作

3
我可以帮您翻译这段内容。以下是翻译结果,保留了原文中的HTML标签:

我在GitHub上有一个简单的Node.js应用程序,我想使用GitHub actions构建Docker镜像并将其推送到AWS ECR。

aws.yml:

name: foo-bar CI

on:
  pull_request:
    branches:         
    - sandbox
  push:
    branches:         
    - sandbox   

env:
  AWS_REPOSITORY_URL: ${{ secrets.AWS_REPOSITORY_URL }}
  AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

jobs:
  build-and-push:
    name: Build and push image to AWS ECR
    runs-on: ubuntu-latest
    steps:

    - name: Checkout
      uses: actions/checkout@master

    - name: Check REPO url
      run: echo $AWS_REPOSITORY_URL

    - name: Setup ECR
      run: $( aws ecr get-login --no-include-email --region ap-south-1)

    - name: Build and tag the image
      run: docker build -t $AWS_REPOSITORY_URL .

    - name: Push
      run: docker push $AWS_REPOSITORY_URL

我已经在仓库主页>设置>密码中添加了AWS_REPOSITORY_URLAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY

我确定输入的值是正确的,我也在gitlab-ci中使用这些值,它可以正常工作。

当我推送到sandbox分支时,CI作业开始运行并出现以下错误-

Current runner version: '2.263.0'
Operating System
  Ubuntu
  18.04.4
  LTS
Virtual Environment
  Environment: ubuntu-18.04
  Version: 20200525.2
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu18/20200525.2/images/linux/Ubuntu1804-README.md
Prepare workflow directory
Prepare all required actions
Download action repository 'actions/checkout@sandbox'
##[error]An action could not be found at the URI 'https://api.github.com/repos/actions/checkout/tarball/sandbox'

我做错了什么?我的YML文件有错误吗?
从日志来看,作业在Checkout步骤失败。它试图从https://api.github.com/repos/actions/checkout/tarball/sandbox下载某些内容,但是因为返回了404错误(我尝试在浏览器中打开该URL),下载失败了。我认为它应该尝试从https://api.github.com/repos/actions/checkout/tarball/master下载内容。但是我不确定它为什么会出现这种情况。
1个回答

4

由于某种原因,GitHub在Checkout步骤中出现了误解。

执行时它使用的是actions/checkout@sandbox而不是actions/checkout@master。可能是由于https://github.com/aws-actions/master分支存在问题所致。我尝试使用v2标签代替,它可以正常工作。

所以更新后的Checkout步骤是-

- name: Checkout
  uses: actions/checkout@v2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接