actions / actions/runner

Provide Git repository context to action builder

Open
#767 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement future
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Build container for action use” stage described in the issue, then inspect the referenced action.yml and Dockerfile flow. Compare the available context during the git archive build with the requested uses repository and ref; done means an action can access the needed Git context or explicitly request a working directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker, git, github-actions
Domain
build-system, ci-cd, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.