mirror of
https://github.com/actions/checkout.git
synced 2024-11-25 20:39:32 +01:00
Include common example for fetching PR base-ref
Since this seems to be a common scenario and is generating a lot of discussion (#93), it seems worthwhile to add it to the readme as an example. I placed it before the other fetch examples because this use-case still only fetches minimal history (only adding one additional ref); so it seems helpful to place this above the other fetch examples which all do deeper fetches.
This commit is contained in:
parent
94c2de77cc
commit
11d9aa95eb
1 changed files with 12 additions and 0 deletions
12
README.md
12
README.md
|
@ -112,15 +112,18 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
|
|||
|
||||
- [Checkout a different branch](#Checkout-a-different-branch)
|
||||
- [Checkout HEAD^](#Checkout-HEAD)
|
||||
|
||||
- [Checkout multiple repos (side by side)](#Checkout-multiple-repos-side-by-side)
|
||||
- [Checkout multiple repos (nested)](#Checkout-multiple-repos-nested)
|
||||
- [Checkout multiple repos (private)](#Checkout-multiple-repos-private)
|
||||
- [Checkout pull request HEAD commit instead of merge commit](#Checkout-pull-request-HEAD-commit-instead-of-merge-commit)
|
||||
- [Checkout pull request on closed event](#Checkout-pull-request-on-closed-event)
|
||||
- [Fetch pull request base-ref in addition to merge commit (for diffing)](#Fetch-pull-request-base-ref-in-addition-to-merge-commit-for-diffing)
|
||||
- [Fetch all tags](#Fetch-all-tags)
|
||||
- [Fetch all branches](#Fetch-all-branches)
|
||||
- [Fetch all history for all tags and branches](#Fetch-all-history-for-all-tags-and-branches)
|
||||
|
||||
|
||||
## Checkout a different branch
|
||||
|
||||
```yaml
|
||||
|
@ -207,6 +210,15 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
```
|
||||
|
||||
## Fetch pull request base-ref in addition to merge commit (for diffing)
|
||||
|
||||
```yml
|
||||
- uses: actions/checkout@v2
|
||||
- name: Fetch base_ref HEAD
|
||||
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
|
||||
- run: git diff origin/${{github.base_ref}}..HEAD
|
||||
```
|
||||
|
||||
## Fetch all tags
|
||||
|
||||
```yaml
|
||||
|
|
Loading…
Reference in a new issue