[GH-ISSUE #912] Issue: actions/checkout doesn't copy git tracked but gitignored files #543

Closed
opened 2026-03-01 21:44:19 +03:00 by kerem · 10 comments
Owner

Originally created by @jsoref on GitHub (Dec 2, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/912

The general behavior of .gitignore doesn't prevent files that are tracked from being checked out. It just prevents from from being updated or added.

I'd expect that act not copy over untracked files matched by .gitignore, but I'd expect it to include tracked files that are matched by .gitignore.

System information

  • Operating System: Linux & macOS
  • Architecture: x64
  • Apple M1: no
  • Docker version: on macOS: 20.10.8 (not sure about the version used by GHA)
  • Docker image used in act: catthehacker/ubuntu:act-latest
  • act version: 0.2.25

Expected behaviour

Files listed in .gitignore should be present in the checked out repository

Actual behaviour

Files listed in .gitignore are not present

Workflow and/or repository

github.com/jsoref/ignored@bfbee7f061
https://github.com/jsoref/ignored/runs/4398686247?check_suite_focus=true

github.com/jsoref/ignored@5e20813c26
https://github.com/jsoref/ignored/runs/4398859601?check_suite_focus=true

Steps to reproduce

  1. Push github.com/jsoref/ignored@bfbee7f061 to a GitHub repo
  2. Check the action log
  3. Push github.com/jsoref/ignored@5e20813c26 to the GitHub repo
  4. Check the action log

act output

Log
[What do I have/Introspection] Skipping local actions/checkout because workdir was already copied
Originally created by @jsoref on GitHub (Dec 2, 2021). Original GitHub issue: https://github.com/nektos/act/issues/912 The general behavior of `.gitignore` doesn't prevent files that are tracked from being checked out. It just prevents from from being updated or added. I'd expect that act not copy over untracked files matched by `.gitignore`, but I'd expect it to include tracked files that are matched by `.gitignore`. ## System information <!-- - Operating System: < Windows | Linux | macOS | etc... > - Architecture: < x64 (64-bit) | x86 (32-bit) | arm64 (64-bit) | arm (32-bit) | etc... > - Apple M1: < yes | no > - Docker version: < output of `docker system info -f "{{.ServerVersion}}"` > - Docker image used in `act`: < can be omitted if it's included in log > - `act` version: < output of `act --version`, if you've built `act` yourself, please provide commit hash > --> - Operating System: Linux & macOS - Architecture: x64 - Apple M1: no - Docker version: on macOS: 20.10.8 (not sure about the version used by GHA) - Docker image used in `act`: catthehacker/ubuntu:act-latest - `act` version: 0.2.25 ## Expected behaviour Files listed in `.gitignore` should be present in the checked out repository ## Actual behaviour Files listed in `.gitignore` are not present ## Workflow and/or repository https://github.com/jsoref/ignored/commit/bfbee7f061955141522839cbb6abf690678adfb0 https://github.com/jsoref/ignored/runs/4398686247?check_suite_focus=true https://github.com/jsoref/ignored/commit/5e20813c26869ea46a07a4ec03481c911377979c https://github.com/jsoref/ignored/runs/4398859601?check_suite_focus=true ## Steps to reproduce 1. Push https://github.com/jsoref/ignored/commit/bfbee7f061955141522839cbb6abf690678adfb0 to a GitHub repo 2. Check the action log 3. Push https://github.com/jsoref/ignored/commit/5e20813c26869ea46a07a4ec03481c911377979c to the GitHub repo 4. Check the action log ## `act` output <details> <summary>Log</summary> ```none [What do I have/Introspection] Skipping local actions/checkout because workdir was already copied ``` </details>
kerem 2026-03-01 21:44:19 +03:00
  • closed this issue
  • added the
    kind/bug
    label
Author
Owner

@catthehacker commented on GitHub (Dec 2, 2021):

Have you tried --use-gitignore=false?

<!-- gh-comment-id:984875455 --> @catthehacker commented on GitHub (Dec 2, 2021): Have you tried `--use-gitignore=false`?
Author
Owner

@jsoref commented on GitHub (Dec 2, 2021):

Yes, it would work, see the second commit/run.

But I shouldn't need to

<!-- gh-comment-id:984882262 --> @jsoref commented on GitHub (Dec 2, 2021): Yes, it would work, see the second commit/run. But I shouldn't need to
Author
Owner

@catthehacker commented on GitHub (Dec 2, 2021):

Right, we can't change behaviour because it will break functionality for other people

<!-- gh-comment-id:984885264 --> @catthehacker commented on GitHub (Dec 2, 2021): Right, we can't change behaviour because it will break functionality for other people
Author
Owner

@jsoref commented on GitHub (Dec 2, 2021):

I see three possible behaviors:

  1. Copy all files
  2. Copy all files not matching .gitignore
  3. Copy all files except non tracked files matched by .gitignore

The current default is 2. The flag gets 1. I'm looking for 3.

The distinction between 2 and 3 is imo a bug, hence this bug.

<!-- gh-comment-id:984890113 --> @jsoref commented on GitHub (Dec 2, 2021): I see three possible behaviors: 1. Copy all files 2. Copy all files not matching `.gitignore` 3. Copy all files except non tracked files matched by `.gitignore` The current default is 2. The flag gets 1. I'm looking for 3. The distinction between 2 and 3 is imo a bug, hence this bug.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 2, 2022):

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

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

@jsoref commented on GitHub (Jan 2, 2022):

Please tag

<!-- gh-comment-id:1003641859 --> @jsoref commented on GitHub (Jan 2, 2022): Please tag
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2022):

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

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

@jsoref commented on GitHub (Feb 2, 2022):

It's still a thing...

<!-- gh-comment-id:1027489360 --> @jsoref commented on GitHub (Feb 2, 2022): It's still a thing...
Author
Owner

@github-actions[bot] commented on GitHub (Mar 6, 2022):

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

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

@jsoref commented on GitHub (Mar 6, 2022):

It's still a thing...

<!-- gh-comment-id:1059859602 --> @jsoref commented on GitHub (Mar 6, 2022): It's still a thing...
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#543
No description provided.