checkout icon indicating copy to clipboard operation
checkout copied to clipboard

Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/data/workflow_dir/_actions/actions/checkout/v2.4.0'.

Open imam opened this issue 2 years ago • 14 comments

Hi,

For some reason since yesterday, whenever Github Action ran, they'll failed on the first attempt, but will always succeed on the second attempt.

The error message:

Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/data/workflow_dir/_actions/actions/checkout/v2.4.0'. Did you forget to run actions/checkout before running your local action?

Would be lovely if anyone can help, thanks! :)

image

image

imam avatar Feb 10 '22 08:02 imam

Additional notes:

I've tried to downgrade the actions/checkout to 2.3.x and 2.2.x, same error messages occured

imam avatar Feb 10 '22 08:02 imam

Any word on this. Lots of people including me are seeing this on post run. My issue stems from what I believe is I connect via checkout@v2 or v3 to a different repo then the action is running under and if I remove the blocks for that everything works so some wires get crossed when you are on a repo in the main action that kicks off the workflow but then inside that workflow you use a different repo and wires get crossed on Post Run, but everything worked in run. Weird: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' Its such a dumb error cause if the action wasnt there it could have never run. Like how the heck CANT a post run find an action that the main run just executed from...

homeaidepi avatar Apr 28 '22 14:04 homeaidepi

Talking out my problem gave me some inspiration. Finally a breakthrough. So I just added this to the end of my action # Checkout the repo - uses: actions/checkout@v3 with: # Repository name with owner. For example, actions/checkout Default: ${{ github.repository }} So Post Run needs to get connected back with this running actions repo and not whatever repo you connect to perform some external operation. Silly I need to remind the Action what its repo is, (by rechecking out to "this" or "local scope") but whatever, I got it and hope it helps someone.

homeaidepi avatar Apr 28 '22 14:04 homeaidepi

I'm experiencing the same in combination with:

- name: Upload result to GitHub Code Scanning
  uses: github/codeql-action/upload-sarif@v1
  with:
    sarif_file: snyk.sarif

inlet avatar May 05 '22 11:05 inlet

Was having the same problem. Looks like it only currently supports it as a whole job rather than in a step. https://github.community/t/actions-reusable-workflow-failing-to-find-action-yml-that-does-exist/231258/3

kaleidawave avatar Jun 07 '22 13:06 kaleidawave

multi-checkout-action

checkout@v2 should be the first one

- uses: actions/checkout@v2
- name: Checkout private actions
  uses: vweevers/multi-checkout-action@v1
  with:
    token: ${{ secrets.GITHUB_MACHINE_TOKEN }}
    repositories: my-org/example-action my-org/[email protected] my-org/third-action

DmitriiKalashnik avatar Jul 20 '22 09:07 DmitriiKalashnik

Was having the same problem. Looks like it only currently supports it as a whole job rather than in a step. https://github.community/t/actions-reusable-workflow-failing-to-find-action-yml-that-does-exist/231258/3

I wish GitHub would keep topics from being deleted (I'm trying to set up my CI and already ran into a handful of dead community links), thankfully the Internet Archive has a copy https://web.archive.org/web/20220427182405/https://github.community/t/actions-reusable-workflow-failing-to-find-action-yml-that-does-exist/231258/3

kerryj89 avatar Sep 22 '22 23:09 kerryj89

Was having the same problem. Looks like it only currently supports it as a whole job rather than in a step. https://github.community/t/actions-reusable-workflow-failing-to-find-action-yml-that-does-exist/231258/3

I wish GitHub would keep topics from being deleted (I'm trying to set up my CI and already ran into a handful of dead community links), thankfully the Internet Archive has a copy https://web.archive.org/web/20220427182405/https://github.community/t/actions-reusable-workflow-failing-to-find-action-yml-that-does-exist/231258/3

You are confusing workflows with actions, if you define

  • uses inside the steps block is for calling an action (a block of steps)
  • uses outside the steps block is for calling a workflow.

webblocksapp avatar Sep 27 '22 16:09 webblocksapp

it took me hours of to figure out this, thanks @homeaidepi for pointing it out.

In my case I have my composite action, inside the action I checkout to another repo. And it keeps on showing Post Run failed for the action. Then I realized that I need to checkout again to my main repo again (origin repo, where workflow triggered)

maitrungduc1410 avatar Oct 26 '22 14:10 maitrungduc1410

@maitrungduc1410 and @homeaidepi THANK YOU for your comments--this worked for me!!!

To reiterate for future readers deep in the rabbit of debugging: in the context of calling a local action ("local" meaning in the same repo as the workflow calling the action, and "action" meaning a composite action, which is different from a reusable workflow), if that action checks out other repos, the runner fails to clean up the original workspace that triggered the workflow. That's because during clean-up, the runner's in the repo the action checked out, so it can no longer find the action file. A workaround to this is to check out the original repo again so that now the runner can clean up the local action.

Failed run: Notice how the action and post-action `Update Zephyrus' succeeded; it's the original job clean up that failed. image

Successful run: image

Sophie1142 avatar Apr 10 '23 19:04 Sophie1142

What is the exact solution team i am getting the same error @Sophie1142

kumarsachin1990 avatar Apr 13 '23 17:04 kumarsachin1990

What worked for me was to remove the Checkout step from the local action

stevenosse avatar Apr 13 '23 19:04 stevenosse

Hi, I have another solution don't need re-checkout origin source using path of checkout@v3 action and working-directory keyword for run steps.

for ex:

- name: Checkout tools repo
  uses: actions/checkout@v3
  with:
    repository: my-org/my-tools
    path: my-tools

- name: Install Dependencies
  working-directory: my-tools
  shell: bash
  run: npm install

- name: do something else
  shell: bash
  working-directory: my-tools
  run: |
    date > generated.txt
    git config user.name github-actions
    git config user.email [email protected]
    git add .
    git commit -m "generated"
    git push

Hope it helps you guys!.

nploi avatar Apr 19 '23 18:04 nploi

For us, the solution was found here https://github.com/orgs/community/discussions/26245#discussioncomment-5962450

bobbyg603 avatar Feb 27 '24 22:02 bobbyg603