Issue with GitHub Actions in private repository

I’ve an issue with a very simple GitHub action I’ve created in the private repository of my company.

I created the action in my public repository to test it until I was sure it’ll work without issues. When I was sure I moved the code to the repository of my company and when the PR was approved … i got the following error:

2020-05-05T22:18:50.6032068Z ##[endgroup]
2020-05-05T22:18:50.6033002Z Prepare workflow directory
2020-05-05T22:18:50.6403965Z Prepare all required actions
2020-05-05T22:18:50.6415177Z Download action repository 'my_company/project_repository@master'
2020-05-05T22:18:53.7750330Z ##[error]Could not find file '/home/runner/work/_actions/_temp_c6ac66cf-579d-43d8-9e56-e182d67ff55e/_staging/my_company-project_repository-bd9057cb6dd6fcdf55e67414737633253c319d22/go/src/my_company/project_repository/xxx/yyy/zzz/something'.

So I thought it was an issue using a private repository so I created a new one with my personal account but it worked without any issue even using a private repository so I make it public if I can get some help: https://github.com/Klaudioz/github_actions_private

I’m thinking the issue can be that I’m user of a private organization but I need some help. In my research I found only that: https://www.pinel.cc/blog/2019/11/02/private-github-actions but I’m not sure if it’s correct.

Thanks.

Hi @klaudioz ,

As doc mentioned as below:

To use an action defined in a private repository, both the workflow file and the action must be in the same repository. Your workflow cannot use actions defined in other private repositories, even if the other private repository is in the same organization.

The link you refered is a workaround for private repo action, use personal access token to checkout the private repo content to folder “./.github/actions”, and invoke it then. I created a private action based on your private one, and realized it, please check my workflow here: https://github.com/zwdgg1985/repo1/runs/648607749?check_suite_focus=true

And it also mentioned in similar ticket here: https://github.community/t5/GitHub-Actions/Github-action-action-in-private-repository/m-p/54341/highlight/true#M9141

Hence, you can use the same workaround for your company repo private action. Or you have to make sure workflow file and action in same repository.

Hope it’s clear and helpful.

1 Like

Hello @weide-zhou and thanks for your detailed explanation.

The workflow and the action are in the same repository. The file structure is something like that:

company_project

  action.yml

  …

  .github/workflows/main.yml

  build_tools/github_docker/Dockerfile

  build_tools/github_docker/script.sh

  …

I’ll try to create a new repository in my company and do a test with this new information.

I’ve created a private repository in the organization, I did exactly what I did previously so the repository has the 4 files, I’ve created a new branch to generate a PR to run the workflow and it worked perfectly so I can’t understand why I’m having that issue.

Hi @klaudioz,

Thanks for your reply! Just for confirmation, does the private action work fine in your new repository?

Acccording to your original error message, should be caused by file path or go path setting in action repo.

That’s is not the case. Actually the action is being applied to the same repository. I mean I don’t have a repository for the exclusive GitHub action.

Sorry i’m a little confused. As you mentioned: ‘I’ve created a new branch to generate a PR to run the workflow and it worked perfectly so I can’t understand why I’m having that issue.’  

If the issue still exists for you, could you please share the issue action repo since i cannot reproduce the same with the action you provided. Thanks.

The issue was because one file had a symlink. So this repository has thousand of files so I was hard to catch that.

Thanks @klaudioz for your reply, so the issue is resolved after removing/editing the symlink?

Yes, I’d to create the action in a different repository and call it from the one I want to use it clonning it first and using a Token.