-
Notifications
You must be signed in to change notification settings - Fork 1
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
[BUG] This action inside a workflow executed inside a container doesn't work #19
Comments
-- https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user This document is about Dockerfile support, but this action doesn't use Dockerfile. |
Not this action ! but I use this action inside a container... |
With the action checkout as mentioned in my issue |
I see. |
Do you use a Docker image whose USER is a non root user? |
I use a docker image without USER in Dockerfile, so with root user. And I run action/checkout inside container. |
I see. Thank you. I'm trying to understand your issue correctly. I ran the following workflow, then jobs:
container-test-job:
runs-on: ubuntu-latest
container:
image: "debian:bookworm-20240701"
steps:
- run: whoami
- run: apt-get update
- run: apt-get install -y git
- uses: actions/checkout@v4
- run: ls -lh
- run: git diff --quiet README.md https://github.com/suzuki-shunsuke/test-github-action-2/actions/runs/9987965762/job/27603427863
The workflow succeeded if I didn't use a container. jobs:
container-test-job:
runs-on: ubuntu-latest
# container:
# image: "debian:bookworm-20240701"
steps:
- run: whoami
# - run: apt-get update
# - run: apt-get install -y git
- uses: actions/checkout@v4
- run: ls -lh
- run: git diff --quiet README.md |
https://github.com/suzuki-shunsuke/test-github-action-2/actions/runs/9988100119/job/27603835920 - run: git diff -C "$ROOT_DIR" --quiet README.md
env:
ROOT_DIR: ${{ github.workspace }}
I'm not sure why I checked $PWD just in case, but it's same with |
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- run: git diff --quiet README.md https://github.com/suzuki-shunsuke/test-github-action-2/actions/runs/9988435719/job/27604893593 |
So I think this issue has nothing to do with this action. |
Wow, nice debugging and good job thinking to try that workaround. Indeed, it should work that way! However, I still think it's a good idea to adapt this action to make it work in both cases, even if the command: |
I will use this workaround. You are the owner of this action, so you have the final say. |
Hmm, action/checkout has the option https://github.com/actions/checkout # Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: '' I checked the action log, and it looks
Is this change temporary?
|
Thank you for your understanding. I close this issue. |
This line:
github-action-terraform-init/main.sh
Line 20 in a0f2e06
causes this action to fail when executed through a GitHub Action workflow running inside a container due to a couple of problems:
The owner of the folder containing the repository checked out inside a container is the user who runs the container. However, the user who clones the content of the repo with the GitHub Action checkout is "root" as defined here: https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user.
The workaround seems very simple:
Should be changed to :
The text was updated successfully, but these errors were encountered: