question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document .gitignore behaviour

See original GitHub issue

Description

Currently, all files that are set to be ignored in .gitignore will not be deployed by the action. This seems to be caused by the git clone operation and, while I haven’t been able to find any discussion on this in issues or PRs (I used github’s search tool, so I might be on the wrong here), I think it’s safe to assume that this is the intended behaviour.

I believe that this behaviour could be counterintuitive to some users, so it may be interesting to document it on the readme, or at least discuss the idea here.

Reproduction

  1. Create a repository that includes a .gitignore file that blacklists some files
  2. Set up a CI pipeline that deploys the directory that contains the .gitignore file using this action
  3. Files specified on .gitignore will not be deployed

You can see this behaviour on this CI run.

Reasons why this can be unexpected

I personally got confused by this behaviour, as I expected .gitignored files to be deployed. My thought process went along the lines of:

  1. People usually deploy build artifacts
  2. Build artifacts are usually excluded from git through .gitignore
  3. Thus, .gitignore files are probably not ignored when deploying

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
corollaricommented, Aug 10, 2020

Personally, I am setting up a repository that hosts different projects, and each one of these will have it’s own CI workflow, which publishes the build artifacts to a different subdirectory on gh-pages. I was planning on doing that using keep_file on the whole repo (in a manner very similar to what you described in #324), so, at the end of the day, I will be publishing a git repository on publish_dir.

Now, it’s possible to change the CI to isolate the published subdirectories from the rest of the github repo, but that didn’t seem as something that needed to be done, so I just went ahead with that and got bit by having all of my build artifacts (which are on .gitignores) not be deployed.

With that said, I seem to be the only one that has run into this problem thus far, so I believe it’s fine to not document it, just thought that I would explain my case since other users might run into the same problem.

1reaction
corollaricommented, Aug 10, 2020

This is not a bug, sorry for botching the label.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gitignore Documentation - Git
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below...
Read more >
Ignoring in Git: How To Use .gitignore Files - BMC Software
The .gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root ......
Read more >
Does git specify recursive behaviour for gitignore patterns?
Suppose that .gitignore consists of the line hello , while dir/.gitignore consists of the line bar . The file hello in both directories...
Read more >
How can I ignore a file that has already been committed to a ...
Git can only ignore files that are untracked - files that haven't been committed to the repository, yet. That's why, when you create...
Read more >
gitignore examples to ignore files, folder & pattern
The .gitignore is a file containing a list of files or folders that allows you to command Git to pass over/ignore in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found