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
我添加了AWS_REPOSITORY_URL,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY 在 repository-home>settings>secrets.
我确信我输入了正确的值,我也在 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 which gives 404 (I tried to open the URL in the browser). I think it should have tried to download from 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
我在 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
我添加了AWS_REPOSITORY_URL,AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY 在 repository-home>settings>secrets.
我确信我输入了正确的值,我也在 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 which gives 404 (I tried to open the URL in the browser). I think it should have tried to download from 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