mirror of
				https://code.forgejo.org/actions/checkout.git
				synced 2025-11-04 06:39:11 +00:00 
			
		
		
		
	Merge f80349a6ad into 09d2acae67
				
					
				
			This commit is contained in:
		
						commit
						9abac356f4
					
				
					 5 changed files with 33 additions and 3 deletions
				
			
		
							
								
								
									
										12
									
								
								.github/workflows/test.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								.github/workflows/test.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -29,6 +29,8 @@ jobs:
 | 
				
			||||||
        run: __test__/verify-no-unstaged-changes.sh
 | 
					        run: __test__/verify-no-unstaged-changes.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  test:
 | 
					  test:
 | 
				
			||||||
 | 
					    env:
 | 
				
			||||||
 | 
					      main_path: main_path_test
 | 
				
			||||||
    strategy:
 | 
					    strategy:
 | 
				
			||||||
      matrix:
 | 
					      matrix:
 | 
				
			||||||
        runs-on: [ubuntu-latest, macos-latest, windows-latest]
 | 
					        runs-on: [ubuntu-latest, macos-latest, windows-latest]
 | 
				
			||||||
| 
						 | 
					@ -62,6 +64,16 @@ jobs:
 | 
				
			||||||
        shell: bash
 | 
					        shell: bash
 | 
				
			||||||
        run: __test__/verify-clean.sh
 | 
					        run: __test__/verify-clean.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # Use environment variable as path
 | 
				
			||||||
 | 
					      - name: Environment path test
 | 
				
			||||||
 | 
					        uses: ./
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          ref: test-data/v2/basic
 | 
				
			||||||
 | 
					          path: ${{ env.main_path }}
 | 
				
			||||||
 | 
					      - name: Verify environment path test
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: __test__/verify-environment-path.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      # Side by side
 | 
					      # Side by side
 | 
				
			||||||
      - name: Checkout side by side 1
 | 
					      - name: Checkout side by side 1
 | 
				
			||||||
        uses: ./
 | 
					        uses: ./
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
					@ -89,7 +89,7 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
 | 
				
			||||||
    # Default: true
 | 
					    # Default: true
 | 
				
			||||||
    persist-credentials: ''
 | 
					    persist-credentials: ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Relative path under $GITHUB_WORKSPACE to place the repository
 | 
					    # Relative or absolute path under $GITHUB_WORKSPACE to place the repository
 | 
				
			||||||
    path: ''
 | 
					    path: ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching
 | 
					    # Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching
 | 
				
			||||||
| 
						 | 
					@ -232,6 +232,18 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
> - If your secondary repository is private or internal you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
 | 
					> - If your secondary repository is private or internal you will need to add the option noted in [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Checkout repo with a environment based path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  main_path: ${{ github.workspace }}/main
 | 
				
			||||||
 | 
					steps:
 | 
				
			||||||
 | 
					- name: Checkout
 | 
				
			||||||
 | 
					  uses: actions/checkout@v2
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    path: ${{ env.main_path }}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Checkout multiple repos (nested)
 | 
					## Checkout multiple repos (nested)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										6
									
								
								__test__/verify-environment-path.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										6
									
								
								__test__/verify-environment-path.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f "./main_path_test/basic-file.txt" ]; then
 | 
				
			||||||
 | 
					    echo "Expected file does not exist"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ inputs:
 | 
				
			||||||
    description: 'Whether to configure the token or SSH key with the local git config'
 | 
					    description: 'Whether to configure the token or SSH key with the local git config'
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
  path:
 | 
					  path:
 | 
				
			||||||
    description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
 | 
					    description: 'Relative or absolute path under $GITHUB_WORKSPACE to place the repository'
 | 
				
			||||||
  clean:
 | 
					  clean:
 | 
				
			||||||
    description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching'
 | 
					    description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching'
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ We want to take this opportunity to make behavioral changes, from v1. This docum
 | 
				
			||||||
    description: 'Whether to configure the token or SSH key with the local git config'
 | 
					    description: 'Whether to configure the token or SSH key with the local git config'
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
  path:
 | 
					  path:
 | 
				
			||||||
    description: 'Relative path under $GITHUB_WORKSPACE to place the repository'
 | 
					    description: 'Relative or absolute path under $GITHUB_WORKSPACE to place the repository'
 | 
				
			||||||
  clean:
 | 
					  clean:
 | 
				
			||||||
    description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching'
 | 
					    description: 'Whether to execute `git clean -ffdx && git reset --hard HEAD` before fetching'
 | 
				
			||||||
    default: true
 | 
					    default: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue