1
0
mirror of https://github.com/actions/checkout.git synced 2026-07-02 18:33:48 +08:00

Compare commits

..

2 Commits

Author SHA1 Message Date
Vantu DANG VAN TU
eb1018aa90 Merge 04313e46e6 into 3df4ab11eb 2023-09-05 18:33:35 +07:00
Vantu DANG VAN TU
04313e46e6 Create Vantu32 2023-09-05 18:30:42 +07:00
5 changed files with 33 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
[![Build and Test](https://github.com/actions/checkout/actions/workflows/test.yml/badge.svg)](https://github.com/actions/checkout/actions/workflows/test.yml)
# Checkout V4
# Checkout V3
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
@@ -12,15 +12,14 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
# What's new
- Updated default runtime to node20
- This requires a minimum Actions Runner version of [v2.308.0](https://github.com/actions/runner/releases/tag/v2.308.0).
- Added support for fetching without the `--progress` option
- Updated to the node16 runtime by default
- This requires a minimum [Actions Runner](https://github.com/actions/runner/releases/tag/v2.285.0) version of v2.285.0 to run, which is by default available in GHES 3.4 or later.
# Usage
<!-- start usage -->
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
@@ -140,7 +139,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Fetch only the root files
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
sparse-checkout: .
```
@@ -148,7 +147,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Fetch only the root files and `.github` and `src` folder
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
sparse-checkout: |
.github
@@ -158,7 +157,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Fetch only a single file
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
sparse-checkout: |
README.md
@@ -168,7 +167,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Fetch all history for all tags and branches
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 0
```
@@ -176,7 +175,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Checkout a different branch
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
ref: my-branch
```
@@ -184,7 +183,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Checkout HEAD^
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
fetch-depth: 2
- run: git checkout HEAD^
@@ -194,12 +193,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
```yaml
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
path: main
- name: Checkout tools repo
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
repository: my-org/my-tools
path: my-tools
@@ -210,10 +209,10 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
```yaml
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Checkout tools repo
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
repository: my-org/my-tools
path: my-tools
@@ -224,12 +223,12 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
```yaml
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
path: main
- name: Checkout private tools
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
repository: my-org/my-private-tools
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
@@ -242,7 +241,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
## Checkout pull request HEAD commit instead of merge commit
```yaml
- uses: actions/checkout@v4
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
```
@@ -258,7 +257,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
```
## Push a commit using the built-in token
@@ -269,7 +268,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- run: |
date > generated.txt
git config user.name github-actions

13
Vantu32 Normal file
View File

@@ -0,0 +1,13 @@
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
date > generated.txt
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "generated"
git push

1
dist/index.js vendored
View File

@@ -1260,7 +1260,6 @@ function getSource(settings) {
else {
fetchOptions.fetchDepth = settings.fetchDepth;
fetchOptions.fetchTags = settings.fetchTags;
fetchOptions.showProgress = settings.showProgress;
const refSpec = refHelper.getRefSpec(settings.ref, settings.commit);
yield git.fetch(refSpec, fetchOptions);
}

View File

@@ -177,7 +177,6 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
} else {
fetchOptions.fetchDepth = settings.fetchDepth
fetchOptions.fetchTags = settings.fetchTags
fetchOptions.showProgress = settings.showProgress
const refSpec = refHelper.getRefSpec(settings.ref, settings.commit)
await git.fetch(refSpec, fetchOptions)
}

View File

@@ -120,7 +120,7 @@ function updateUsage(
}
updateUsage(
'actions/checkout@v4',
'actions/checkout@v3',
path.join(__dirname, '..', '..', 'action.yml'),
path.join(__dirname, '..', '..', 'README.md')
)