Skip to content

Cant run Gitea Actions from private Repo #26032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Schrolli91 opened this issue Jul 21, 2023 · 5 comments
Closed

Cant run Gitea Actions from private Repo #26032

Schrolli91 opened this issue Jul 21, 2023 · 5 comments
Labels
issue/duplicate The issue has already been reported. topic/gitea-actions related to the actions of Gitea type/bug

Comments

@Schrolli91
Copy link

Schrolli91 commented Jul 21, 2023

Description

I have a private Repo with an example action.
Its totaly clear to me, that the runner can not clone this private repo without authentication.
So i use the checkout action with a personal access token and clone the action repo to the runner.
After that i try to run the action as follwing:

  - name: Check out repository code
    uses: actions/checkout@v3
    with:
      token: ${{ secrets.token }}
  - name: Hello world action step
    id: hello
    uses: ./

But this does not work.
I have seen, that the Github docs show exactly this tooling for private repos.
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-an-action-inside-a-different-private-repository-than-the-workflow

Also i cant find any clear instructions or documentation, how to deal with private repos in actions on gitea.

Gitea Version

1.20.0

Operating System

Debian Linux

How are you running Gitea?

Running via docker in an debian Linux hosted inside a VPS (LXC)

@wolfogre wolfogre added the topic/gitea-actions related to the actions of Gitea label Jul 21, 2023
@wolfogre
Copy link
Member

wolfogre commented Jul 21, 2023

Have you set a right secret with token as the name?

Actually, you don't need to do this. The runner will get a temporary token to checkout the repo even it's private. Please try again without with:

  - name: Check out repository code
    uses: actions/checkout@v3

@Schrolli91
Copy link
Author

Schrolli91 commented Jul 21, 2023

secret is set and it can clone successful - without it cant (login on gitea instance is required).
The runner maybe can checkout the "repo under test". But what happens if i want to use a action, that is hosted in another private repo?

This is the job from the github hello world action (https://github.com/actions/hello-world-docker-action), hosted on my own gitea server.
The folowing code will fail:
image

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: A job to say hello
    steps:
      - name: Check out repository code
        uses: actions/checkout@v3
      - name: Hello world action step
        id: hello
        uses: https://gitea..####/actions/hello-world-docker-action@main
        with:
          who-to-greet: 'test action'
      - name: Get the output time
        run: echo "The time was ${{ steps.hello.outputs.time }}"

@wolfogre
Copy link
Member

So the point is that your runner failed with uses: https://gitea..####/actions/hello-world-docker-action@main.

Now it's duplicated with #25929

@wolfogre wolfogre closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2023
@wolfogre wolfogre added the issue/duplicate The issue has already been reported. label Jul 21, 2023
@Schrolli91
Copy link
Author

Schrolli91 commented Jul 21, 2023

Clone via Personal Access Token is working. This can show me the content of my repo:

steps:
  - name: Check out repository code
    uses: actions/checkout@v3
    with:
      token: ${{ secrets.token }}
  - name: show local dir
    run: ls -lah
  - name: Hello world action step
    id: hello
    uses: ./
    with:
      who-to-greet: 'Test Action'
  - name: Get the output time
    run: echo "The time was ${{ steps.hello.outputs.time }}"

So my main question is, why running a action from local cloned content is not possible on the runner?
Github can reference the local dir in the uses: directive. This seems not to work in Gitea - is this correct?

image

@wolfogre
Copy link
Member

So my main question is, why running a action from local cloned content is not possible on the runner?

It is not supported yet.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/duplicate The issue has already been reported. topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

No branches or pull requests

2 participants