Description
I have an app that depends on having access to it's own Git repository history to determine its version and other information about itself. I can build my own Docker images just fine locally or on Docker Hub because when I copy my app's source into the container using the Dockerfile:
COPY ./ /src
...the source includes a .git
folder and is a proper Git working directory. On Docker Hub the checkout is shallow with no history, but that's fixable using git fetch --unshallow && git fetch --tags
.
Under GitHub Actions the "Build container for action use" stag provides zero information to work with. The source directory I get is a bare extract of a git archive
, i.e. not a working directory. I checked the environment variables and at that point there aren't even any useful bits of data such as who we are or what branch we are supposed to be on.
As a result if I try to use an action repository like this:
steps:
- name: My Job
uses: myaction/repository@my-branch
The Dockefile in my repository gets built from a git archive
of my-branch which is the correct code, but there is no way to determine the Git context — even the name of the repository and my-branch information is not available as content.
I would like to see at the very least environment variables set during the container build phase that say something about the Actions uses
context. An even more complete fix for my application might be a way to request in my action.yml
file that builds be run in a git working directory rather than a bare archive extraction.