Skip to content

Commit 8e2d67e

Browse files
Merge pull request #2 from GuillaumeFalourd/v2
V2
2 parents d791c99 + 746f49b commit 8e2d67e

File tree

6 files changed

+109
-42
lines changed

6 files changed

+109
-42
lines changed

.github/workflows/private-repo.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ on:
99

1010
jobs:
1111

12-
job-public-repo:
12+
job-public-repo-ubuntu:
1313
runs-on: ubuntu-latest
1414
steps:
1515

1616
- name: Clone GuillaumeFalourd/formulas-training PRIVATE repository
17-
uses: GuillaumeFalourd/clone-github-repo-action@main
17+
uses: GuillaumeFalourd/clone-github-repo-action@v2
1818
with:
1919
owner: 'GuillaumeFalourd'
2020
repository: 'formulas-training'
@@ -23,7 +23,46 @@ jobs:
2323
- name: Access cloned repository content
2424
run: |
2525
echo "ROOT"
26-
ls -l
26+
ls -la
2727
echo "CLONED REPO"
2828
cd formulas-training
29-
ls -l
29+
ls -la
30+
31+
job-public-repo-macos:
32+
runs-on: macos-latest
33+
steps:
34+
35+
- name: Clone GuillaumeFalourd/formulas-training PRIVATE repository
36+
uses: GuillaumeFalourd/clone-github-repo-action@v2
37+
with:
38+
owner: 'GuillaumeFalourd'
39+
repository: 'formulas-training'
40+
access-token: ${{ secrets.ACCESS_TOKEN }}
41+
42+
- name: Access cloned repository content
43+
run: |
44+
echo "ROOT"
45+
ls -la
46+
echo "CLONED REPO"
47+
cd formulas-training
48+
ls -la
49+
50+
job-public-repo-window:
51+
runs-on: windows-latest
52+
steps:
53+
54+
- name: Clone GuillaumeFalourd/formulas-training PRIVATE repository
55+
uses: GuillaumeFalourd/clone-github-repo-action@v2
56+
with:
57+
owner: 'GuillaumeFalourd'
58+
repository: 'formulas-training'
59+
access-token: ${{ secrets.ACCESS_TOKEN }}
60+
61+
- name: Access cloned repository content
62+
run: |
63+
echo "ROOT"
64+
ls -la
65+
echo "CLONED REPO"
66+
cd formulas-training
67+
ls -la
68+
shell: bash

.github/workflows/public-repo.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,57 @@ on:
99

1010
jobs:
1111

12-
job-public-repo:
12+
job-public-repo-ubuntu:
1313
runs-on: ubuntu-latest
1414
steps:
1515

1616
- name: Clone GuillaumeFalourd/poc-github-actions PUBLIC repository
17-
uses: GuillaumeFalourd/clone-github-repo-action@main
17+
uses: GuillaumeFalourd/clone-github-repo-action@v2
1818
with:
1919
owner: 'GuillaumeFalourd'
2020
repository: 'poc-github-actions'
2121

2222
- name: Access cloned repository content
2323
run: |
2424
echo "ROOT"
25-
ls -l
25+
ls -la
2626
echo "CLONED REPO"
2727
cd poc-github-actions
28-
ls -l
28+
ls -la
29+
30+
job-public-repo-macos:
31+
runs-on: macos-latest
32+
steps:
33+
34+
- name: Clone GuillaumeFalourd/poc-github-actions PUBLIC repository
35+
uses: GuillaumeFalourd/clone-github-repo-action@v2
36+
with:
37+
owner: 'GuillaumeFalourd'
38+
repository: 'poc-github-actions'
39+
40+
- name: Access cloned repository content
41+
run: |
42+
echo "ROOT"
43+
ls -la
44+
echo "CLONED REPO"
45+
cd poc-github-actions
46+
ls -la
47+
48+
job-public-repo-windows:
49+
runs-on: windows-latest
50+
steps:
51+
52+
- name: Clone GuillaumeFalourd/poc-github-actions PUBLIC repository
53+
uses: GuillaumeFalourd/clone-github-repo-action@v2
54+
with:
55+
owner: 'GuillaumeFalourd'
56+
repository: 'poc-github-actions'
57+
58+
- name: Access cloned repository content
59+
run: |
60+
echo "ROOT"
61+
ls -la
62+
echo "CLONED REPO"
63+
cd poc-github-actions
64+
ls -la
65+
shell: bash

Dockerfile

Lines changed: 0 additions & 10 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Github Action to clone a **public** or **private** Github repository and access
1010

1111
[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DGuillaumeFalourd%2Fclone-github-repo-action%26badge%3Dtrue)](https://github.com/search?o=desc&q=GuillaumeFalourd+clone-github-repo-action+path%3A.github%2Fworkflows+language%3AYAML&s=&type=Code)[Who is using this action? (public repositories)](https://github.com/search?q=clone-github-repo-action+path%3A.github%2Fworkflows+language%3AYAML&type=code)
1212

13+
## What changed with the action `v2` ?
14+
15+
This action `v2` is using a **composite action** to be compatible with all operating systems (the `v1` was using a **Dockerfile** that was only compatible with `ubuntu-*` runners).
16+
1317
## How to use this action?
1418

1519
Create a new `.yml` file on your `.github/workflows` directory.
@@ -29,7 +33,7 @@ You can use one of those as reference:
2933

3034
```bash
3135
- name: Clone GuillaumeFalourd/poc-github-actions PUBLIC repository
32-
uses: GuillaumeFalourd/clone-github-repo-action@v1
36+
uses: GuillaumeFalourd/clone-github-repo-action@v2
3337
with:
3438
owner: 'GuillaumeFalourd'
3539
repository: 'poc-github-actions'
@@ -41,7 +45,7 @@ To use this action to clone a `PRIVATE` repository the Github User/Admin has acc
4145

4246
```bash
4347
- name: Clone GuillaumeFalourd/formulas-training PRIVATE repository
44-
uses: GuillaumeFalourd/clone-github-repo-action@v1
48+
uses: GuillaumeFalourd/clone-github-repo-action@v2
4549
with:
4650
owner: 'GuillaumeFalourd'
4751
repository: 'formulas-training'
@@ -62,7 +66,7 @@ cd <repository-name>
6266
- name: Access cloned repository content
6367
run: |
6468
cd <repository-name>
65-
ls -l
69+
ls -la
6670
```
6771

6872
## Licensed

action.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,24 @@ inputs:
1414
required: false
1515

1616
runs:
17-
using: 'docker'
18-
image: 'Dockerfile'
19-
args:
20-
- ${{ inputs.owner }}
21-
- ${{ inputs.repository }}
22-
- ${{ inputs.access-token }}
17+
using: 'composite'
18+
steps:
19+
- name: Clone repository
20+
run: |
21+
if [ -z "${{ inputs.access-token }}" ]; then
22+
git clone https://github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
23+
else
24+
git clone https://${{ inputs.access-token }}@github.com/${{ inputs.owner }}/${{ inputs.repository }}.git
25+
fi
26+
27+
if [ -d "${{ inputs.repository }}" ]; then
28+
echo "Cloned ${{ inputs.repository }} repository successfully."
29+
echo "Access the repository content using \"cd ${{ inputs.repository }}\"."
30+
else
31+
echo "Error: Couldn't clone ${{ inputs.repository }} repository. Check the inputs or the PAT scope."
32+
exit 1
33+
fi
34+
shell: bash
2335

2436
branding:
2537
icon: 'download'

entrypoint.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)