簡體   English   中英

Github 動作錯誤 找不到動作

[英]Github actions error An action could not be found

我在 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(我試圖在瀏覽器中打開 ZE6B391A8D2C4D459703DZ3)。 我認為它應該嘗試從https://api.github.com/repos/actions/checkout/tarball/master下載。 我不確定為什么它會這樣。

由於某種原因,GitHub 誤解了Checkout步驟。

它在執行時使用actions/checkout@sandbox而不是actions/checkout@master 可能這是https://github.com/aws-actions/master分支中的一個錯誤。 我嘗試了v2標簽,但它確實有效。

所以更新的結帳步驟是 -

- name: Checkout
  uses: actions/checkout@v2

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM