Github操作错误找不到操作

时间:2020-06-01 05:07:44

标签: git github github-actions building-github-actions

我在GitHub上有一个简单的nodejs应用,我想构建一个docker映像并通过GitHub操作推送到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

我已在 repository-home>设置>秘密中添加了 AWS_REPOSITORY_URL AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY 。 / p>

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

当我推送到沙箱分支时,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文件有错误吗?

根据日志判断,作业在结帐步骤中失败。它正在尝试从https://api.github.com/repos/actions/checkout/tarball/sandbox下载某些内容,该内容为404(我试图在浏览器中打开URL)。我认为它应该尝试从https://api.github.com/repos/actions/checkout/tarball/master下载。我不确定为什么会这样。

1 个答案:

答案 0 :(得分:3)

由于某些原因,GitHub错误地解释了Checkout步骤。

在执行时它正在使用actions/checkout@sandbox而不是actions/checkout@master。可能是https://github.com/aws-actions/分支中的master中的一个错误。我改用了 v2 标签,它可以正常工作。

所以更新后的Checkout步骤是-

- name: Checkout
  uses: actions/checkout@v2