From e34fae7ab2d820e2e3724d7e5072d338ed98822f Mon Sep 17 00:00:00 2001 From: ange Date: Sun, 28 Apr 2024 23:16:07 +0200 Subject: [PATCH] first commit --- README.md | 1 + action.yaml | 17 +++++++++++++++++ checkout.sh | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 README.md create mode 100644 action.yaml create mode 100755 checkout.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..54e407c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# checkout@v1 diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..34d1897 --- /dev/null +++ b/action.yaml @@ -0,0 +1,17 @@ +name: checkout +inputs: + token: + description: A token to authenticate on behalf of the GitHub App installed on your repository. + default: ${{ gitea.token }} + +runs: + using: composite + steps: + - name: Checkout + run: ${{ gitea.action_path }}/checkout.sh + env: + ACTION_REPOSITORY: ${{ gitea.repository }} + ACTION_REPOSITORY_OWNER: ${{ gitea.repository_owner }} + ACTION_SERVER_URL: ${{ gitea.server_url }} + ACTION_SHA: ${{ gitea.sha }} + ACTION_TOKEN: ${{ inputs.token }} diff --git a/checkout.sh b/checkout.sh new file mode 100755 index 0000000..2d1253b --- /dev/null +++ b/checkout.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e + +URL="${ACTION_SERVER_URL/\/\//\/\/$ACTION_REPOSITORY_OWNER:$ACTION_TOKEN@}/$ACTION_REPOSITORY" + +git init -b main +git remote add origin "$URL" +git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin "$ACTION_SHA" +git checkout --progress --force -B main "$ACTION_SHA"