Skip to content
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

.gitignore should be ignored for actions #193

Closed
alanb-sony opened this issue Apr 14, 2020 · 21 comments · Fixed by #537
Closed

.gitignore should be ignored for actions #193

alanb-sony opened this issue Apr 14, 2020 · 21 comments · Fixed by #537
Labels
area/action Relating to running an action kind/feature-request New feature or request
Projects

Comments

@alanb-sony
Copy link
Contributor

I'm trying to use the get-cmake action to download cmake. Strangely it has dist listed in its .gitignore so dist doesn't get copied into the docker container and the action fails.

@cplee
Copy link
Contributor

cplee commented Apr 16, 2020

Looks like it was removed, ok to close this issue now?

lukka/get-cmake#3

@cplee cplee added the kind/question Further information is requested label Apr 16, 2020
@cplee cplee added this to Ready to Work in Roadmap Apr 16, 2020
@cplee cplee moved this from Ready to Work to Done in Roadmap Apr 16, 2020
@cplee cplee removed this from Done in Roadmap Apr 16, 2020
@cplee cplee added this to Done in Roadmap Apr 16, 2020
@cplee cplee moved this from Done to In progress in Roadmap Apr 16, 2020
@alanb-sony
Copy link
Contributor Author

The get-cmake action has been fixed but in general checking the git-ignore for actions is not necessary and could cause problems like this again in the future

@cplee
Copy link
Contributor

cplee commented Apr 17, 2020

Hey @alanb-sony - thanks for the PR! I need some help though understanding the scenario. Why wouldn't you want a .gitignore to be used within the action? I'm thinking of node_modules for example.

This seems like a bug with the cmake action in which there was a bad gitignore that needed to be fixed.

@alanb-sony
Copy link
Contributor Author

doesn't act checkout a clean git copy of each action then copy the action to docker? There shouldn't be any uncommitted files in the host copy as it is never used for anything other than copying to docker?

@cplee
Copy link
Contributor

cplee commented Apr 17, 2020

It does...unless you are using a local action, stored in the same repo as your workflow with something like uses: ./.github/my-local-action

In that case, you would want any .gitignore to kick in to ensure you don't copy in files like node_modules

@cplee cplee moved this from In progress to Under Review in Roadmap Apr 23, 2020
@cplee
Copy link
Contributor

cplee commented May 4, 2020

@alanb-sony - thoughts on comment above? still make sense to consider #198?

@alanb-sony
Copy link
Contributor Author

I think some change is a good idea, don't know what though. I'm not a go expert (or even a novice)

@wagenet
Copy link

wagenet commented May 7, 2020

@cplee I think it would make sense to only respect .gitignore for local actions.

@marcaddeo
Copy link

This is also causing issues with actions/cache@v1 as it has dist/ in it's .gitignore

@cplee cplee added area/action Relating to running an action kind/feature-request New feature or request and removed kind/question Further information is requested labels May 13, 2020
@cplee
Copy link
Contributor

cplee commented May 13, 2020

I like @wagenet idea - only use .gitignore for local actions

@github-actions
Copy link
Contributor

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

@christopinka
Copy link

There seems to be a discrepancy between how Github runner behaves vs. an Act runner. I have a go project that is passing in Github and only passes in act if I delete the .gitignore. It leads me to believe that the Github runner is ignoring .gitignore and copying the files that go test can't find in Act unless I remove .gitignore. Should behave the same way.

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale label Nov 11, 2020
@wagenet
Copy link

wagenet commented Nov 12, 2020

Still should remain open.

@github-actions github-actions bot removed the stale label Jan 19, 2021
@github-actions
Copy link
Contributor

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

@wagenet
Copy link

wagenet commented Feb 23, 2021

There is a PR but it isn’t yet merged.

@github-actions github-actions bot removed the stale label Feb 24, 2021
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale label Mar 26, 2021
@wagenet
Copy link

wagenet commented Mar 26, 2021

I think we still need this.

@github-actions github-actions bot removed the stale label Mar 27, 2021
@jamesmortensen
Copy link

One of the use cases for using act to run workflows is to iterate and debug parts of them more quickly. If I want to fix a problem in the workflow, I don't necessarily need to do a fresh checkout of my codebase each time. Also, I can run workflows against uncommitted changes to decide whether or not I'm ready to commit. This allows me to move faster.

Some flag to be able to ignore the .gitignore would be awesome.

@miketalley
Copy link

miketalley commented Apr 12, 2021

I'm having an issue because .env is included in the .gitignore for the project. When running act the environment variables within .env are not getting loaded. Commenting out the .env line in .gitignore and running act seems to resolve the issue, but that means the .env would be committed to source control. ☹️

Having to change this each time that I run act is not great. A flag to ignore the .gitignore would be ideal and solve this issue.

@Totktonada
Copy link

My two coins regarding solution that would be ideal for me.

LT;DR: I would lean on git ls-files to create an include-list rather than on .gitignore to create an exclude-list.

The act tool is quite similar to packpack in the following aspect: both copy sources into a docker container and perform some work inside. Both assume that a developer's working tree may be not a clear copy, so just recursive copying is not the option.

The packpack tool runs git ls-files (for the repository and for its submodules) and creates a tarball with all listed files. The tarball is unpacked inside the container then. Untracked files will not go into the container, however gitignored files that are under git control will go.

Another nice property is that I can use git add to temporarily mark some new files as tracked and verify my build in a container.

My experience with this approach is great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/action Relating to running an action kind/feature-request New feature or request
Projects
Roadmap
  
Done
8 participants