Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authoreric sciple <ericsciple@users.noreply.github.com>2019-12-13 16:39:47 -0500
committerGitHub <noreply@github.com>2019-12-13 16:39:47 -0500
commitc1d1cd6a24af0fb80d2719b26c1735427c8930a3 (patch)
tree9ddf0f00980397b2c53393566ef8d6d68bfd54e1 /README.md
parent16f5649d38a91abdbb6c5103bfa22e7e5bdc7d1d (diff)
add more scenarios (#112)
Diffstat (limited to 'README.md')
-rw-r--r--README.md111
1 files changed, 105 insertions, 6 deletions
diff --git a/README.md b/README.md
index 46cefb5..3b97f52 100644
--- a/README.md
+++ b/README.md
@@ -73,26 +73,84 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
```
<!-- end usage -->
+# Scenarios
+
+- [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)
+- [Checkout submodules](#Checkout-submodules)
+- [Fetch all tags](#Fetch-all-tags)
+- [Fetch all branches](#Fetch-all-branches)
+
## Checkout a different branch
```yaml
- uses: actions/checkout@v2
with:
- ref: some-branch
+ ref: my-branch
```
-## Checkout a different, private repository
+## Checkout HEAD^
```yaml
- uses: actions/checkout@v2
with:
- repository: myAccount/myRepository
- ref: refs/heads/master
+ fetch-depth: 2
+- run: git checkout HEAD^
+```
+
+## Checkout multiple repos (side by side)
+
+```yaml
+- name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: main
+
+- name: Checkout tools repo
+ uses: actions/checkout@v2
+ with:
+ repository: my-org/my-tools
+ path: my-tools
+```
+
+## Checkout multiple repos (nested)
+
+```yaml
+- name: Checkout
+ uses: actions/checkout@v2
+
+- name: Checkout tools repo
+ uses: actions/checkout@v2
+ with:
+ repository: my-org/my-tools
+ path: my-tools
+```
+
+## Checkout multiple repos (private)
+
+```yaml
+- name: Checkout
+ uses: actions/checkout@v2
+ with:
+ path: main
+
+- name: Checkout private tools
+ uses: actions/checkout@v2
+ with:
+ repository: my-org/my-private-tools
token: ${{ secrets.GitHub_PAT }} # `GitHub_PAT` is a secret that contains your PAT
+ path: my-tools
```
-> - `${{ 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
+> - `${{ github.token }}` is scoped to the current repository, so if you want to checkout a different 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 pull request HEAD commit instead of merge commit
```yaml
- uses: actions/checkout@v2
@@ -100,6 +158,47 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
ref: ${{ github.event.pull_request.head.sha }}
```
+## Checkout pull request on closed event
+
+```yaml
+on:
+ pull_request:
+ branches: [master]
+ types: [opened, synchronize, closed]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+```
+
+## Checkout submodules
+
+```yaml
+- uses: actions/checkout@v2
+- name: Checkout submodules
+ shell: bash
+ run: |
+ auth_header="$(git config --local --get http.https://github.com/.extraheader)"
+ git submodule sync --recursive
+ git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
+```
+
+## Fetch all tags
+
+```yaml
+- uses: actions/checkout@v2
+- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
+```
+
+## Fetch all branches
+
+```yaml
+- uses: actions/checkout@v2
+- run: |
+ git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
+```
+
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)