${{ github.workspace }} does not have its contents in an external workflow #10500

Closed
opened 2025-11-02 09:09:32 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @ghnp5 on GitHub (Mar 23, 2023).

Hello,

I'm trying something like this:

      - name: Test 1
        run: whoami > ${{ github.workspace }}/whoami.txt
      - name: Test 2
        uses: https://github.com/addnab/docker-run-action@v3
        with:
          image: docker:latest
          options: -v ${{ github.workspace }}:/work
          run: ls -la /work && echo "Test" > /work/test.log && ls -la /work
      - name: Test 3
        run: |
          ls -la ${{ github.workspace }}
          cat ${{ github.workspace }}/test.log

But /work doesn't seem to contain anything that is in ${{ github.workspace }}, in the Test 2 step, when I do ls -la /work.
In Test 3, the file ${{ github.workspace }}/test.log does not exist. But, the file whoami.txt created in Test 1 does.

This behavior is happening in Gitea 1.19.0, running on Docker (if that makes any difference to the act_runner).

--

However, when I try this workflow in GitHub Actions (but using addnab/docker-run-action@v3 instead of the full URL, otherwise it crashes for that), everything works as expected and the file ${{ github.workspace }}/test.log is accessible in Test 3.

--

Gitea Version

1.19.0

Can you reproduce the bug on the Gitea demo site?

Actions don't seem to be enabled there.

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using Docker (docker-compose.yml) with MySQL.

Database

MySQL

Originally created by @ghnp5 on GitHub (Mar 23, 2023). Hello, I'm trying something like this: ``` - name: Test 1 run: whoami > ${{ github.workspace }}/whoami.txt - name: Test 2 uses: https://github.com/addnab/docker-run-action@v3 with: image: docker:latest options: -v ${{ github.workspace }}:/work run: ls -la /work && echo "Test" > /work/test.log && ls -la /work - name: Test 3 run: | ls -la ${{ github.workspace }} cat ${{ github.workspace }}/test.log ``` But `/work` doesn't seem to contain anything that is in `${{ github.workspace }}`, in the `Test 2` step, when I do `ls -la /work`. In `Test 3`, the file `${{ github.workspace }}/test.log` does not exist. But, the file `whoami.txt` created in `Test 1` does. This behavior is happening in Gitea 1.19.0, running on Docker (if that makes any difference to the act_runner). -- However, when I try this workflow in GitHub Actions (but using `addnab/docker-run-action@v3` instead of the full URL, otherwise it crashes for that), everything works as expected and the file `${{ github.workspace }}/test.log` is accessible in `Test 3`. -- ### Gitea Version 1.19.0 ### Can you reproduce the bug on the Gitea demo site? Actions don't seem to be enabled there. ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Using Docker (docker-compose.yml) with MySQL. ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 09:09:32 -06:00
Author
Owner

@ghnp5 commented on GitHub (Mar 23, 2023):

Ok, I believe I understand what's happening.

I'm not sure if this would be an issue if I installed act_runner directly in the host. (haven't tested)

However, I'm running act_runner in Docker like this:

services:
  gitea_actions:
    container_name: gitea_actions
    image: gitea_actions:latest
    build:
      context: .
      dockerfile: ./Dockerfile
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Notice I'm mounting docker.sock.

--

So, at the time the Test 1 and Test 3 run, ${{ github.workspace }} is actually (on the host):

/...path_to_docker_dataroot.../volumes/GITEA-ACTIONS-TASK-11_WORKFLOW-...._JOB-deploy-certificates/_data

However, when Test 2 runs, for addnab/docker-run-action@v3, ${{ github.workspace }} is actually (on the host):

/gituser/actions/

That's because the container that addnab/docker-run-action@v3 spins is directly in the host, and therefore it's not "chrooted".

I'll try to accommodate for this, but just wanted to share my findings :)

@ghnp5 commented on GitHub (Mar 23, 2023): Ok, I believe I understand what's happening. I'm not sure if this would be an issue if I installed `act_runner` directly in the host. (haven't tested) However, I'm running `act_runner` in Docker like this: ``` services: gitea_actions: container_name: gitea_actions image: gitea_actions:latest build: context: . dockerfile: ./Dockerfile restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock ``` Notice I'm mounting `docker.sock`. -- So, at the time the `Test 1` and `Test 3` run, `${{ github.workspace }}` is actually (on the host): > /...path_to_docker_dataroot.../volumes/GITEA-ACTIONS-TASK-11_WORKFLOW-...._JOB-deploy-certificates/_data However, when `Test 2` runs, for `addnab/docker-run-action@v3`, `${{ github.workspace }}` is actually (on the host): > /gituser/actions/ That's because the container that `addnab/docker-run-action@v3` spins is directly in the host, and therefore it's not "chrooted". I'll try to accommodate for this, but just wanted to share my findings :)
Author
Owner

@wolfogre commented on GitHub (Mar 24, 2023):

Has been replied at https://gitea.com/gitea/act_runner/issues/72

@wolfogre commented on GitHub (Mar 24, 2023): Has been replied at https://gitea.com/gitea/act_runner/issues/72
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10500