@@ -3,48 +3,38 @@ name: 'Clone Github Repo Action'
3
3
description : " Github Action to clone a public or private Github repository and access its content on others repositories' workflows."
4
4
5
5
inputs :
6
- owner :
7
- description : ' Repository Owner'
8
- required : true
9
- repository :
10
- description : ' Repository name'
11
- required : true
12
- access-token :
13
- description : ' PAT with repository scope (https://github.com/settings/tokens)'
14
- required : false
15
- branch :
16
- desciption : ' Repository Branch'
17
- required : false
6
+ owner :
7
+ description : ' Repository Owner'
8
+ required : true
9
+ repository :
10
+ description : ' Repository name'
11
+ required : true
12
+ access-token :
13
+ description : ' PAT with repository scope (https://github.com/settings/tokens)'
14
+ required : false
15
+ branch :
16
+ description : ' Repository Branch'
17
+ required : false
18
18
19
19
runs :
20
- using : ' composite'
21
- steps :
20
+ using : ' composite'
21
+ steps :
22
+ - name : Missing required value
23
+ if : ${{ github.event.inputs.owner == '' || github.event.inputs.repository == '' }}
24
+ run : echo "Missing Required Value!"
22
25
- name : Clone repository
26
+ if : ${{ github.event.inputs.owner != '' && github.event.inputs.repository != '' }}
23
27
run : |
24
- if [ -z " ${{ inputs.access-token }}" ]; then
25
- if [ -z " ${{ inputs.branch }}" ]; then
26
- git clone https://github.com/ ${{ inputs.owner }}/ ${{ inputs.repository }}.git
27
- else
28
- git clone https://github.com/ ${{ inputs.owner }}/${{ inputs.repository }}.git -b ${{ inputs.branch }}
29
- fi
28
+ if [[ -z ${{ github.event. inputs.access-token }} && -z ${{ github.event.inputs.branch }} ] ]; then
29
+ git clone https://github.com/ ${{ inputs.owner }}/${{ inputs.repository }}.git
30
+ elif [[ -z ${{ github.event. inputs.access-token }} && -n ${{ github.event. inputs.branch }} ]]; then
31
+ git clone https://github.com/${{ inputs.owner }}/${{ inputs.repository }}.git -b ${{ inputs.branch }}
32
+ elif [[ -n ${{ github.event. inputs.access-token }} && -z ${{ github.event. inputs.branch }} ]]; then
33
+ git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
30
34
else
31
- git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
32
- if [ -z "${{ inputs.branch }}" ]; then
33
- git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
34
- else
35
- git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git -b ${{ inputs.branch }}
36
- fi
37
- fi
38
-
39
- if [ -d "${{ inputs.repository }}" ]; then
40
- echo "Cloned ${{ inputs.repository }} repository successfully."
41
- echo "Access the repository content using \"cd ${{ inputs.repository }}\"."
42
- else
43
- echo "Error: Couldn't clone ${{ inputs.repository }} repository. Check the inputs or the PAT scope."
44
- exit 1
45
- fi
35
+ git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git -b ${{ inputs.branch }}
46
36
shell : bash
47
37
48
38
branding :
49
- icon : ' download'
50
- color : ' blue'
39
+ icon : ' download'
40
+ color : ' blue'
0 commit comments