mirror of
https://github.com/actions/checkout.git
synced 2025-09-14 19:52:21 +08:00
Compare commits
1 Commits
73dbf279e3
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
|
1b0793cc05 |
@@ -17,4 +17,4 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@0.0.3
|
||||
uses: actions/publish-immutable-action@v0.0.4
|
||||
|
2
.github/workflows/update-test-ubuntu-git.yml
vendored
2
.github/workflows/update-test-ubuntu-git.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
|
||||
# Use `docker/build-push-action` to build (and optionally publish) the image.
|
||||
- name: Build Docker Image (with optional Push)
|
||||
uses: docker/build-push-action@v6.5.0
|
||||
uses: docker/build-push-action@v6.10.0
|
||||
with:
|
||||
context: .
|
||||
file: images/test-ubuntu-git.Dockerfile
|
||||
|
13
README.md
13
README.md
@@ -126,10 +126,6 @@ Please refer to the [release page](https://github.com/actions/checkout/releases/
|
||||
# running from unless specified. Example URLs are https://github.com or
|
||||
# https://my-ghes-server.example.com
|
||||
github-server-url: ''
|
||||
|
||||
# Set Git object format to "sha256" when initializing a Git repository.
|
||||
# Default: false
|
||||
repo-sha256: ''
|
||||
```
|
||||
<!-- end usage -->
|
||||
|
||||
@@ -315,17 +311,8 @@ jobs:
|
||||
git commit -m "generated"
|
||||
git push
|
||||
```
|
||||
|
||||
*NOTE:* The user email is `{user.id}+{user.login}@users.noreply.github.com`. See users API: https://api.github.com/users/github-actions%5Bbot%5D
|
||||
|
||||
# Recommended permissions
|
||||
|
||||
When using the `checkout` action in your GitHub Actions workflow, it is recommended to set the following `GITHUB_TOKEN` permissions to ensure proper functionality, unless alternative auth is provided via the `token` or `ssh-key` inputs:
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
contents: read
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
|
@@ -98,10 +98,6 @@ inputs:
|
||||
github-server-url:
|
||||
description: The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com
|
||||
required: false
|
||||
repo-sha256:
|
||||
description: 'Set Git object format to "sha256" when initializing a Git repository.'
|
||||
required: false
|
||||
default: false
|
||||
outputs:
|
||||
ref:
|
||||
description: 'The branch, tag or SHA that was checked out'
|
||||
|
15
dist/index.js
vendored
15
dist/index.js
vendored
@@ -709,14 +709,9 @@ class GitCommandManager {
|
||||
getWorkingDirectory() {
|
||||
return this.workingDirectory;
|
||||
}
|
||||
init(repoSHA256) {
|
||||
init() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['init'];
|
||||
if (repoSHA256) {
|
||||
args.push(`--object-format=sha256`);
|
||||
}
|
||||
args.push(this.workingDirectory);
|
||||
yield this.execGit(args);
|
||||
yield this.execGit(['init', this.workingDirectory]);
|
||||
});
|
||||
}
|
||||
isDetached() {
|
||||
@@ -1241,7 +1236,7 @@ function getSource(settings) {
|
||||
// Initialize the repository
|
||||
if (!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))) {
|
||||
core.startGroup('Initializing the repository');
|
||||
yield git.init(settings.repoSHA256);
|
||||
yield git.init();
|
||||
yield git.remoteAdd('origin', repositoryUrl);
|
||||
core.endGroup();
|
||||
}
|
||||
@@ -1836,10 +1831,6 @@ function getInputs() {
|
||||
// Determine the GitHub URL that the repository is being hosted from
|
||||
result.githubServerUrl = core.getInput('github-server-url');
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`);
|
||||
// Set Git object format to "sha256" when initializing a Git repository.
|
||||
result.repoSHA256 =
|
||||
(core.getInput('repo-sha256') || 'false').toUpperCase() === 'TRUE';
|
||||
core.debug(`Repo object format sha256 = ${result.repoSHA256}`);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ export interface IGitCommandManager {
|
||||
): Promise<void>
|
||||
getDefaultBranch(repositoryUrl: string): Promise<string>
|
||||
getWorkingDirectory(): string
|
||||
init(repoSHA256?: boolean): Promise<void>
|
||||
init(): Promise<void>
|
||||
isDetached(): Promise<boolean>
|
||||
lfsFetch(ref: string): Promise<void>
|
||||
lfsInstall(): Promise<void>
|
||||
@@ -327,13 +327,8 @@ class GitCommandManager {
|
||||
return this.workingDirectory
|
||||
}
|
||||
|
||||
async init(repoSHA256?: boolean): Promise<void> {
|
||||
const args = ['init']
|
||||
if (repoSHA256) {
|
||||
args.push(`--object-format=sha256`)
|
||||
}
|
||||
args.push(this.workingDirectory)
|
||||
await this.execGit(args)
|
||||
async init(): Promise<void> {
|
||||
await this.execGit(['init', this.workingDirectory])
|
||||
}
|
||||
|
||||
async isDetached(): Promise<boolean> {
|
||||
|
@@ -110,7 +110,7 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
||||
!fsHelper.directoryExistsSync(path.join(settings.repositoryPath, '.git'))
|
||||
) {
|
||||
core.startGroup('Initializing the repository')
|
||||
await git.init(settings.repoSHA256)
|
||||
await git.init()
|
||||
await git.remoteAdd('origin', repositoryUrl)
|
||||
core.endGroup()
|
||||
}
|
||||
|
@@ -118,9 +118,4 @@ export interface IGitSourceSettings {
|
||||
* User override on the GitHub Server/Host URL that hosts the repository to be cloned
|
||||
*/
|
||||
githubServerUrl: string | undefined
|
||||
|
||||
/**
|
||||
* Set Git object format to "sha256" when initializing a Git repository
|
||||
*/
|
||||
repoSHA256: boolean
|
||||
}
|
||||
|
@@ -161,10 +161,5 @@ export async function getInputs(): Promise<IGitSourceSettings> {
|
||||
result.githubServerUrl = core.getInput('github-server-url')
|
||||
core.debug(`GitHub Host URL = ${result.githubServerUrl}`)
|
||||
|
||||
// Set Git object format to "sha256" when initializing a Git repository.
|
||||
result.repoSHA256 =
|
||||
(core.getInput('repo-sha256') || 'false').toUpperCase() === 'TRUE'
|
||||
core.debug(`Repo object format sha256 = ${result.repoSHA256}`)
|
||||
|
||||
return result
|
||||
}
|
||||
|
Reference in New Issue
Block a user