[GH-ISSUE #1826] actions/checkout: Git hangs in job waiting for username input #889

Closed
opened 2026-03-01 21:47:12 +03:00 by kerem · 5 comments
Owner

Originally created by @deliciouslytyped on GitHub (May 28, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1826

Act info:

$ act --bug-report
act version:            0.2.45
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 12
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:
        /home/cbaksay/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:act-latest
                -P ubuntu-22.04=catthehacker/ubuntu:act-22.04
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
Build info:
        Go version:            go1.20.4
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -trimpath:            true
                CGO_ENABLED:          1
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
Docker Engine:
        Engine version:        20.10.22
        Engine runtime:        runc
        Cgroup version:        1
        Cgroup driver:         cgroupfs
        Storage driver:        overlay2
        Registry URI:          https://index.docker.io/v1/
        OS:                    Ubuntu 20.04.5 LTS
        OS type:               linux
        OS version:            20.04
        OS arch:               x86_64
        OS kernel:             5.4.0-148-generic
        OS CPU:                12
        OS memory:             64165 MB
        Security options:
                name=apparmor
                name=seccomp,profile=default

I'm learning github actions, and I'm developing the below yml to merge one branch to another.
When I run with act -v -s GITHUB_TOKEN=$GITHUB_TOKEN, it hangs.
Using docker -it exec containername /bin/sh, I can get a shell, and inspect /proc/environ of the hanging git fetch process.
After copying that environ to the current shell (with some small errors) using source <(cat /proc/thepid/environ | tr '\0' '\n'), I then run git fetch.
The "hang" seems to happen because its waiting for input:

# git fetch
Username for 'https://github.com':

Given that I based this off of https://medium.com/@karlstad/create-a-github-actions-workflow-that-auto-merges-the-master-back-to-dev-branch-8b1ebe7009b3 , I'm inclined to think the problem is some sort of difference between the act and the github actions environments? Or I'm missing something simple.

GITHUB_REPOSITORY_OWNER is set for example.

The working directory is the directory I ran act in, and it has the dirty git repo.

  • Which is odd, because I expected actions/checkout to check out to some new clean location?
# pwd
/home/user/stuff/mygitdir
# git status
On branch 2_staging
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    .github/workflows/deploy-commits-on-deploy-branch.yml
        modified:   .github/workflows/merge-successful-test-to-deploy.yml
        deleted:    .github/workflows/release-tagged-commit.yml

no changes added to commit (use "git add" and/or "git commit -a")
# https://github.com/actions/starter-workflows/blob/main/ci/maven.yml
# https://medium.com/@karlstad/create-a-github-actions-workflow-that-auto-merges-the-master-back-to-dev-branch-8b1ebe7009b3
name: Merge successful staging tests to deploy

on:
  push:
    branches: [ "staging" ]

jobs:
  merge-to-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Config git
        run: |
          git config --local user.email "actions@github.com"
          git config --local user.name "Github Actions"

      - name: Merge staging to deploy
        run: |
          # TODO IDK why these are the steps
          git fetch --unshallow
          git checkout deploy
          git pull
          git merge staging -m "Merge staging to deploy after successful tests"
          git push

It's a bit of an open question whether I want this to work on the local or remote repository (well, for testing I guess local makes sense). However, as it is, this doesn't do either.

Originally created by @deliciouslytyped on GitHub (May 28, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1826 Act info: ``` $ act --bug-report act version: 0.2.45 GOOS: linux GOARCH: amd64 NumCPU: 12 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/cbaksay/.actrc: -P ubuntu-latest=catthehacker/ubuntu:act-latest -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 Build info: Go version: go1.20.4 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -trimpath: true CGO_ENABLED: 1 GOARCH: amd64 GOOS: linux GOAMD64: v1 Docker Engine: Engine version: 20.10.22 Engine runtime: runc Cgroup version: 1 Cgroup driver: cgroupfs Storage driver: overlay2 Registry URI: https://index.docker.io/v1/ OS: Ubuntu 20.04.5 LTS OS type: linux OS version: 20.04 OS arch: x86_64 OS kernel: 5.4.0-148-generic OS CPU: 12 OS memory: 64165 MB Security options: name=apparmor name=seccomp,profile=default ``` I'm learning github actions, and I'm developing the below yml to merge one branch to another. When I run with `act -v -s GITHUB_TOKEN=$GITHUB_TOKEN`, it hangs. Using `docker -it exec containername /bin/sh`, I can get a shell, and inspect /proc/environ of the hanging `git fetch` process. After copying that environ to the current shell (with some small errors) using `source <(cat /proc/thepid/environ | tr '\0' '\n')`, I then run `git fetch`. The "hang" seems to happen because its waiting for input: ``` # git fetch Username for 'https://github.com': ``` Given that I based this off of https://medium.com/@karlstad/create-a-github-actions-workflow-that-auto-merges-the-master-back-to-dev-branch-8b1ebe7009b3 , I'm inclined to think the problem is some sort of difference between the `act` and the github actions environments? Or I'm missing something simple. GITHUB_REPOSITORY_OWNER _is_ set for example. The working directory is the directory I ran `act` in, and it has the dirty git repo. - Which is odd, because I expected actions/checkout to check out to some new clean location? ``` # pwd /home/user/stuff/mygitdir # git status On branch 2_staging Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) deleted: .github/workflows/deploy-commits-on-deploy-branch.yml modified: .github/workflows/merge-successful-test-to-deploy.yml deleted: .github/workflows/release-tagged-commit.yml no changes added to commit (use "git add" and/or "git commit -a") ``` ``` # https://github.com/actions/starter-workflows/blob/main/ci/maven.yml # https://medium.com/@karlstad/create-a-github-actions-workflow-that-auto-merges-the-master-back-to-dev-branch-8b1ebe7009b3 name: Merge successful staging tests to deploy on: push: branches: [ "staging" ] jobs: merge-to-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Config git run: | git config --local user.email "actions@github.com" git config --local user.name "Github Actions" - name: Merge staging to deploy run: | # TODO IDK why these are the steps git fetch --unshallow git checkout deploy git pull git merge staging -m "Merge staging to deploy after successful tests" git push ``` It's a bit of an open question whether I want this to work on the local or remote repository (well, for testing I guess local makes sense). However, as it is, this doesn't do either.
kerem 2026-03-01 21:47:12 +03:00
  • closed this issue
  • added the
    stale
    label
Author
Owner

@github-actions[bot] commented on GitHub (Nov 25, 2023):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:1826151911 --> @github-actions[bot] commented on GitHub (Nov 25, 2023): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@real-zony commented on GitHub (Dec 7, 2023):

I think I've encountered the same issue. Here is my workflow, and it also gets stuck.

    - name: Commit and Push changes
      run: |
        git config --global user.email "github-actions[bot]@users.noreply.github.com"
        git config --global user.name "github-actions[bot]"
        git add ${{ inputs.dockerfilePath }}
        git commit -m "Update .NET SDK to ${{ steps.get_versions.outputs.latestSdk }} and Runtime to ${{ steps.get_versions.outputs.latestRuntime }}"
        git push -f

2023-12-07_21-10

I believe this issue might be related to #977.

<!-- gh-comment-id:1845319705 --> @real-zony commented on GitHub (Dec 7, 2023): I think I've encountered the same issue. Here is my workflow, and it also gets stuck. ```yaml - name: Commit and Push changes run: | git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git add ${{ inputs.dockerfilePath }} git commit -m "Update .NET SDK to ${{ steps.get_versions.outputs.latestSdk }} and Runtime to ${{ steps.get_versions.outputs.latestRuntime }}" git push -f ``` ![2023-12-07_21-10](https://github.com/nektos/act/assets/3907132/d8471e3c-54f4-45aa-813d-d015d2ce30d8) I believe this issue might be related to #977.
Author
Owner

@github-actions[bot] commented on GitHub (Jun 5, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2148607735 --> @github-actions[bot] commented on GitHub (Jun 5, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Author
Owner

@deliciouslytyped commented on GitHub (Jun 7, 2024):

Probably still broken, didn't test.

<!-- gh-comment-id:2153733746 --> @deliciouslytyped commented on GitHub (Jun 7, 2024): Probably still broken, didn't test.
Author
Owner

@github-actions[bot] commented on GitHub (Dec 5, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2518816097 --> @github-actions[bot] commented on GitHub (Dec 5, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#889
No description provided.