Skip to content

Newly added sparse checkout functionality is not cleaning up after itself #1475

Closed
@markjm

Description

@markjm

Thanks @dscho for contributing #1369 . We have started using it and noticed the following issue

repo-a / .github/workflows/workflow-a.yml

jobs:
  job-1:
    runs-on: internal-runner

- uses: actions/checkout@v3
  with:
    sparse-checkout: |
      .github
      src

running just the above works as expected. But consider another workflow in the same repo

repo-a / .github/workflows/workflow-b.yml

jobs:
  job-12:
    runs-on: internal-runner

- uses: actions/checkout@v3
- run: ls ./not-src

When running workflow-a, then workflow workflow-b, workflow-b will not find any files in ./not-src.

This is because workflow workflow-b runs in the same _work directory as workflow-a. On the first run of workflow-a, we have polluted the repo in a way this action doesn't know about (and thus can't clean up).

Notice that, even in workflow-b:

git config --list will show core.sparseCheckout true
git sparse-checkout list will still include the listed paths
and a simple
ls will only show the sparse directories for workflow-a

It seems that - similar to the auth cleanup (and other pre-run steps) this action does - we need to disable sparse checkout in the pre steps of this action

Note: this is likely only an issue for self-hosted runners which dont get the same cleaning/re-init process github-hosted runners get

Similar-ish issue to recently reported 47fbe2d (for submodules, instead of sparse checkout). @megamanics

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions