-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
53 lines (53 loc) · 1.61 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: 'Checkout From Tag'
author: 'EvilKittenLord'
description: 'Shallow clones a repo to the depth of the specified tag (or commit hash). Depth is auto-detected. '
branding:
icon: settings
color: white
inputs:
repo:
description: "The repository to clone."
required: false
default: "unset"
ssh-token:
description: "Required for cloning private repositories in other organizations."
required: false
default: "unset"
tag:
description: "The tag (or commit hash) to clone to."
required: false
default: "unset"
dir:
description: "The target directory to clone into."
required: false
default: $GITHUB_WORKSPACE
output-depth-only:
description: "Output the detected depth only."
required: false
default: "false"
outputs:
depth:
description: "The depth of the tag/commit."
value: ${{ steps.main.outputs.depth }}
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup SSH
if: ${{ ! inputs.ssh-token == 'unset' }}
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
shell: bash
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< '${{ inputs.ssh-token }}'
- name: Main Operations
id: main
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
GITHUB_REPOSITORY_URL: "[email protected]:${{ github.repository }}.git"
shell: bash
run: |
${{ github.action_path }}/scripts/clone-from-tag.sh -r ${{ inputs.repo }} -t ${{ inputs.tag }} -d ${{ inputs.dir }} -o ${{ inputs.output-depth-only }}
echo "depth=$(cat /tmp/tag_depth)" | tee $GITHUB_OUTPUT