简体   繁体   中英

Github Actions Failing

Github Actions were working in my repository till yesterday. I didnt make any changes in .github/workflows/dev.yml file or in DockerFile.

But, suddenly in recent pushes, my Github Actions fail with the error

Setup, Build, Publish, and Deploy

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?

May I know how to fix this

This is the sample .yml file I am using.

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: |

Here's the snippet of error. 在此处输入图像描述

我通过将uses值更改为

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

There are some changes visit here for details https://github.com/google-github-actions/setup-gcloud#use-google-github-actionssetup-gcloud

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

or steps:
id: deploy
uses: google-github-actions/deploy-cloudrun@main

For anyone wondering why this is not working anymore, check this notice: https://github.com/google-github-actions/setup-gcloud#-notice

Now each action has its own repo, so you have to change the way you reference Google Cloud Platform actions in your yaml:

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

I have faced the similar error. When I was trying to call my local workflow from steps level. Apparently GitHub actions support local workflow call from jobs level. I could not call from inside steps.

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

I am facing similar issue,

Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/_actions/repo_details'. Did you forget to run actions/checkout before running your local action?

I tried to change 'uses' but still same issue, below is my yaml file

name: "Read Yaml"

on: push: branches: - master pull_request: branches: - master

jobs: test-yaml-reader: name: 'Test read-yaml' runs-on: 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 }}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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