mirror of
				https://github.com/actions/checkout.git
				synced 2025-11-04 13:29:15 +08:00 
			
		
		
		
	document scenario: checkout the head commit of a PR (#90)
This commit is contained in:
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@@ -66,7 +66,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
 | 
				
			|||||||
## Checkout a different branch
 | 
					## Checkout a different branch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
- uses: actions/checkout@preview
 | 
					- uses: actions/checkout@v2-beta
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    ref: some-branch
 | 
					    ref: some-branch
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -74,7 +74,7 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
 | 
				
			|||||||
## Checkout a different, private repository
 | 
					## Checkout a different, private repository
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```yaml
 | 
					```yaml
 | 
				
			||||||
- uses: actions/checkout@preview
 | 
					- uses: actions/checkout@v2-beta
 | 
				
			||||||
  with:
 | 
					  with:
 | 
				
			||||||
    repository: myAccount/myRepository
 | 
					    repository: myAccount/myRepository
 | 
				
			||||||
    ref: refs/heads/master
 | 
					    ref: refs/heads/master
 | 
				
			||||||
@@ -82,6 +82,14 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
> - `${{ github.token }}` is scoped to the current repository, so if you want to checkout another repository that is private you will need to provide your own [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
 | 
					> - `${{ github.token }}` is scoped to the current repository, so if you want to checkout another repository that is private you will need to provide your own [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Checkout the HEAD commit of a PR, rather than the merge commit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					- uses: actions/checkout@v2-beta
 | 
				
			||||||
 | 
					  with:
 | 
				
			||||||
 | 
					    ref: ${{ github.event.after }}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# License
 | 
					# License
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
 | 
					The scripts and documentation in this project are released under the [MIT License](LICENSE)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user