繁体   English   中英

Github 操作失败

[英]Github Actions Failing

Github Actions 直到昨天还在我的存储库中工作。 我没有在 .github/workflows/dev.yml 文件或 DockerFile 中进行任何更改。

但是,突然在最近的推送中,我的 Github Actions 因错误而失败

设置、构建、发布和部署

Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/_actions/GoogleCloudPlatform/github-actions/master/setup-gcloud'. Did you forget to run actions/checkout before running your local action?

我可以知道如何解决这个问题吗

这是我正在使用的示例 .yml 文件。

name: Release to Development

on:
  push:
    branches:
      - 'master'
jobs:
  setup-build-publish-deploy:
    name: Setup, Build, Publish, and Deploy
    runs-on: ubuntu-latest
    steps:

    - name: Checkout
      uses: actions/checkout@v2

    # Setup gcloud CLI
    - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
      with:
        version: '270.0.0'
        service_account_email: ${{ secrets.GCLOUD_EMAIL_DEV }}
        service_account_key: ${{ secrets.GCLOUD_AUTH_DEV }}

    # Configure docker to use the gcloud command-line tool as a credential helper
    - run: |
        # Set up docker to authenticate
        # via gcloud command-line tool.
        gcloud auth configure-docker

    # Build the Docker image
    - name: Build
      run: |
        docker build -t "$REGISTRY_HOSTNAME"/"$GKE_PROJECT"/"$IMAGE":"$GITHUB_SHA" \
          --build-arg GITHUB_SHA="$GITHUB_SHA" \
          --build-arg GITHUB_REF="$GITHUB_REF" .

    # Push the Docker image to Google Container Registry
    - name: Publish
      run: |
        docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:$GITHUB_SHA

    # Set up kustomize
    - name: Set up Kustomize
      run: |
        curl -o kustomize --location https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
        chmod u+x ./kustomize

    # Deploy the Docker image to the GKE cluster
    - name: Deploy
      run: |

这是错误的片段。 在此处输入图像描述

我通过将uses值更改为

  • uses: google-github-actions/setup-gcloud@master

有一些变化请访问此处了解详情https://github.com/google-github-actions/setup-gcloud#use-google-github-actionssetup-gcloud

脚步:
编号:gcloud
用途:google-github-actions/setup-gcloud@master

或步骤:
id:部署
用途:google-github-actions/deploy-cloudrun@main

对于想知道为什么这不再起作用的人,请查看此通知: https : //github.com/google-github-actions/setup-gcloud#-notice

现在每个操作都有自己的存储库,因此您必须更改在 yaml 中引用 Google Cloud Platform 操作的方式:

steps:
 - id: gcloud
-  uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
+  uses: google-github-actions/setup-gcloud@master

我遇到了类似的错误。 当我试图从步骤级别调用我的本地工作流程时。 显然 GitHub 操作支持从作业级别调用本地工作流。 我无法从里面的台阶上打电话。

name: Build and Deploy

on:
  push:
    branches: [dev]

permissions:
  id-token: write
  contents: read

jobs:
  build-and-publish:
    steps:

    - name: Checkout
      uses: actions/checkout@v2

    - name: test local call from steps # this do not work
      if: github.ref_name == 'dev'       
      uses: ./.github/workflows/deploy.yml # this is from steps level
        with:
          devops-bucket: bucket-name
          role: iam role for the job

  dev: # this worked well
    if: github.ref_name == 'dev'
    uses: ./.github/workflows/deploy.yml # this is jobs level
    with:
      devops-bucket: bucket-name
      role: iam role for the job

我面临着类似的问题,

错误:在“/home/runner/work/_actions/repo_details”下找不到“action.yml”、“action.yaml”或“Dockerfile”。 您是否忘记在运行本地操作之前运行操作/结帐?

我试图改变“用途”但仍然是同样的问题,下面是我的 yaml 文件

名称:“阅读 Yaml”

on: push: 分支: - master pull_request: 分支: - master

工作:test-yaml-reader:名称:'Test read-yaml' 运行:ubuntu-latest

steps:
  - name: Checkout
    uses: actions/checkout@v1

  - name: Run read-yaml action
    uses: repo_details@master
    id: chart-name
    with:
      file: './dev.yaml'
      key-path: '["chart", "name"]'

#gets output here - name: Get read-yaml output run: echo "${{ steps.chart-name.outputs.data }}"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM