forked from GuillaumeFalourd/clone-github-repo-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
38 lines (33 loc) · 1.24 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
name: 'Clone Github Repo Action'
description: "Github Action to clone a public or private Github repository and access its content on others repositories' workflows."
inputs:
owner:
description: 'Repository Owner'
required: true
repository:
description: 'Repository name'
required: true
access-token:
description: 'PAT with repository scope (https://github.com/settings/tokens)'
required: false
runs:
using: 'composite'
steps:
- name: Clone repository
run: |
if [ -z "${{ inputs.access-token }}" ]; then
git clone https://github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
else
git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
fi
if [ -d "${{ inputs.repository }}" ]; then
echo "Cloned ${{ inputs.repository }} repository successfully."
echo "Access the repository content using \"cd ${{ inputs.repository }}\"."
else
echo "Error: Couldn't clone ${{ inputs.repository }} repository. Check the inputs or the PAT scope."
exit 1
fi
shell: bash
branding:
icon: 'download'
color: 'blue'