Alternative to actions/checkout that does not require node
Find a file
Joshua Behrens bb178de279
All checks were successful
Check / check (push) Successful in 4s
Add git clone alternative to actions/checkout
2026-11-27 17:41:15 +01:00
.forgejo/workflows Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00
.editorconfig Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00
action.yml Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00
git-clone Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00
README.md Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00
renovate.json Add git clone alternative to actions/checkout 2026-11-27 17:41:15 +01:00

Git clone

A Forgejo Actions composite action that clones the repository of the run with git into the workspace. It runs one POSIX sh step, so the job container needs no node and no bash, e.g. alpine/git.

jobs:
    build:
        runs-on: ubuntu-latest
        steps:
            -   name: Git clone
                uses: https://git.tweecore.cloud/actions/git-clone@v1.0.0
                with:
                    depth: 0
Input Default Meaning
token ${{ github.token }} token for the clone; it stays in the clone, so a later git push uses it
ref ${{ github.sha }} commit, branch or tag
depth 1 commits to fetch, 0 fetches the whole history and all tags. pull-request fetches the commits of the pull request and the tip of its base branch as refs/remotes/origin/<base>, so git rev-list HEAD --not refs/remotes/origin/<base> lists the commits of the pull request. It uses --shallow-exclude; when the server refuses that, it deepens both sides in steps of 50 commits until they have a merge base (at most 20 steps), and the clone may then hold up to 49 older commits on each side. A workflow that runs on push and pull_request can use it: runs without a pull request fetch the commit of the run at depth 1 with a notice, and have no refs/remotes/origin/<base>, so a step that lists the commits of the pull request checks GITHUB_BASE_REF first.
sparse empty space separated paths, each starting with /, for a sparse, blobless checkout