【问题标题】:Github actions error An action could not be foundGithub 操作错误找不到操作
【发布时间】:2020-09-19 09:18:50
【问题描述】:

我在 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>settings>secrets 中添加了 AWS_REPOSITORY_URLAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY

我确定我输入了正确的值,我也在 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 文件有错误吗?

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

【问题讨论】:

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


    【解决方案1】:

    由于某种原因,GitHub 误解了Checkout 步骤。

    它在执行时使用actions/checkout@sandbox 而不是actions/checkout@master。可能这是 https://github.com/aws-actions/ 中的一个错误,带有 master 分支。我尝试了 v2 标记,它起作用了。

    所以更新后的结帐步骤是 -

    - name: Checkout
      uses: actions/checkout@v2
    

    【讨论】:

      猜你喜欢
      • 2020-08-20
      • 2020-12-15
      • 2021-11-02
      • 1970-01-01
      • 2020-02-26
      • 1970-01-01
      • 2021-01-27
      • 1970-01-01
      • 2021-08-25
      相关资源
      最近更新 更多