From dfbcfff2a5a52ae78362a53c3bdacb5b4c6ca748 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Tue, 8 Sep 2026 16:06:47 -0400 Subject: [PATCH] initial checkin --- .gitignore | 2 ++ README.md | 24 ++++++++++++++++++++++++ checkout/action.yml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 checkout/action.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..549cdef --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# IDEA +.idea/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..4494833 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Git Actions + +This project intends to implement GitHub/Gitea Actions using `git` rather than Node. + +## Reasoning + +Both [GitHub Actions](https://github.com/actions) and [Gitea Actions](https://gitea.org/actions) rely on Node for their execution. This means they require a minimum version of NodeJS to be installed. + +I have projects that also rely on Node. What if one of those projects needs to be built using an earlier version of Node? + +## Features + +At this time, only `checkout` is implemented: + +## Usage + +```yaml +job: + job1: + steps: + - uses: https://git.inteligr8.com/inteligr8/git-actions/checkout + - run: | + echo "Default branch checked out" +``` diff --git a/checkout/action.yml b/checkout/action.yml new file mode 100644 index 0000000..ee7c425 --- /dev/null +++ b/checkout/action.yml @@ -0,0 +1,37 @@ +name: git-checkout +description: Clones a Git repository +inputs: + # copied from https://github.com/actions/checkout/blob/v7/action.yml + ref: + description: > + The branch, tag or SHA to checkout. When checking out the repository that + triggered a workflow, this defaults to the reference or SHA for that + event. Otherwise, uses the default branch. +runs: + using: "composite" + steps: + - id: git_clone + shell: bash + env: + GIT_REPO_URL: ${{ gitea.server_url }} + GIT_REPO_USERNAME: ${{ gitea.actor }} + GIT_REPO_PASSWORD: ${{ gitea.token }} + GIT_REPO_REF: ${{ inputs.ref }} + WORKSPACE_PATH: ${{ gitea.workspace }} + run: | + GIT_REPO_AUTH_URL=$(echo "${GIT_REPO_URL}" | sed "s~^\(.\+\)://~\1://${GIT_REPO_USERNAME}:${GIT_REPO_PASSWORD}@~") + if [[ -z ${GIT_REPO_REF} ]]; then + git clone ${GIT_REPO_AUTH_URL} ${WORKSPACE_PATH} + else + git clone -b ${GIT_REPO_REF} --single-branch ${GIT_REPO_AUTH_URL} ${WORKSPACE_PATH} + fi + cd + echo "ref=$(git branch --show-current)" >> $GITHUB_OUTPUT + echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT +outputs: + ref: + description: 'The branch, tag or SHA that was checked out' + value: ${{ steps.git_clone.outputs.ref }} + commit: + description: 'The commit SHA that was checked out' + value: ${{ steps.git_clone.outputs.commit }}