initial checkin
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# IDEA
|
||||
.idea/
|
||||
@@ -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"
|
||||
```
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user