mirror of
https://github.com/actions/checkout.git
synced 2024-11-14 21:08:03 +00:00
Compare commits
3 Commits
e7999d80ae
...
5788812922
Author | SHA1 | Date | |
---|---|---|---|
|
5788812922 | ||
|
b684943689 | ||
|
15b44f68ab |
34
.github/workflows/test.yml
vendored
34
.github/workflows/test.yml
vendored
@ -295,3 +295,37 @@ jobs:
|
|||||||
uses: actions/checkout@v4.1.6
|
uses: actions/checkout@v4.1.6
|
||||||
with:
|
with:
|
||||||
path: localClone
|
path: localClone
|
||||||
|
|
||||||
|
test-output:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Clone this repo
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.1.6
|
||||||
|
|
||||||
|
# Basic checkout using git
|
||||||
|
- name: Checkout basic
|
||||||
|
id: checkout
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
ref: test-data/v2/basic
|
||||||
|
|
||||||
|
# Verify output
|
||||||
|
- name: Verify output
|
||||||
|
run: |
|
||||||
|
echo "Commit: ${{ steps.checkout.outputs.commit }}"
|
||||||
|
echo "Ref: ${{ steps.checkout.outputs.ref }}"
|
||||||
|
|
||||||
|
if [ "${{ steps.checkout.outputs.ref }}" != "test-data/v2/basic" ]; then
|
||||||
|
echo "Expected ref to be test-data/v2/basic"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ steps.checkout.outputs.commit }}" != "82f71901cf8c021332310dcc8cdba84c4193ff5d" ]; then
|
||||||
|
echo "Expected commit to be 82f71901cf8c021332310dcc8cdba84c4193ff5d"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# needed to make checkout post cleanup succeed
|
||||||
|
- name: Fix Checkout
|
||||||
|
uses: actions/checkout@v4.1.6
|
||||||
|
@ -98,6 +98,11 @@ inputs:
|
|||||||
github-server-url:
|
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
|
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
|
required: false
|
||||||
|
outputs:
|
||||||
|
ref:
|
||||||
|
description: 'The branch, tag or SHA that was checked out'
|
||||||
|
commit:
|
||||||
|
description: 'The commit SHA that was checked out'
|
||||||
runs:
|
runs:
|
||||||
using: node20
|
using: node20
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
9
dist/index.js
vendored
9
dist/index.js
vendored
@ -805,7 +805,10 @@ class GitCommandManager {
|
|||||||
if (recursive) {
|
if (recursive) {
|
||||||
args.push('--recursive');
|
args.push('--recursive');
|
||||||
}
|
}
|
||||||
yield this.execGit(args);
|
const that = this;
|
||||||
|
yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
yield that.execGit(args);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
submoduleStatus() {
|
submoduleStatus() {
|
||||||
@ -1355,7 +1358,8 @@ function getSource(settings) {
|
|||||||
// Get commit information
|
// Get commit information
|
||||||
const commitInfo = yield git.log1();
|
const commitInfo = yield git.log1();
|
||||||
// Log commit sha
|
// Log commit sha
|
||||||
yield git.log1("--format='%H'");
|
const commitSHA = yield git.log1('--format=%H');
|
||||||
|
core.setOutput('commit', commitSHA.trim());
|
||||||
// Check for incorrect pull request merge commit
|
// Check for incorrect pull request merge commit
|
||||||
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
|
yield refHelper.checkCommitInfo(settings.authToken, commitInfo, settings.repositoryOwner, settings.repositoryName, settings.ref, settings.commit, settings.githubServerUrl);
|
||||||
}
|
}
|
||||||
@ -1897,6 +1901,7 @@ function run() {
|
|||||||
coreCommand.issueCommand('add-matcher', {}, path.join(__dirname, 'problem-matcher.json'));
|
coreCommand.issueCommand('add-matcher', {}, path.join(__dirname, 'problem-matcher.json'));
|
||||||
// Get sources
|
// Get sources
|
||||||
yield gitSourceProvider.getSource(sourceSettings);
|
yield gitSourceProvider.getSource(sourceSettings);
|
||||||
|
core.setOutput('ref', sourceSettings.ref);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
// Unregister problem matcher
|
// Unregister problem matcher
|
||||||
|
@ -420,7 +420,10 @@ class GitCommandManager {
|
|||||||
args.push('--recursive')
|
args.push('--recursive')
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.execGit(args)
|
const that = this
|
||||||
|
await retryHelper.execute(async () => {
|
||||||
|
await that.execGit(args)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async submoduleStatus(): Promise<boolean> {
|
async submoduleStatus(): Promise<boolean> {
|
||||||
|
@ -261,7 +261,8 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||||||
const commitInfo = await git.log1()
|
const commitInfo = await git.log1()
|
||||||
|
|
||||||
// Log commit sha
|
// Log commit sha
|
||||||
await git.log1("--format='%H'")
|
const commitSHA = await git.log1('--format=%H')
|
||||||
|
core.setOutput('commit', commitSHA.trim())
|
||||||
|
|
||||||
// Check for incorrect pull request merge commit
|
// Check for incorrect pull request merge commit
|
||||||
await refHelper.checkCommitInfo(
|
await refHelper.checkCommitInfo(
|
||||||
|
@ -19,6 +19,7 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
// Get sources
|
// Get sources
|
||||||
await gitSourceProvider.getSource(sourceSettings)
|
await gitSourceProvider.getSource(sourceSettings)
|
||||||
|
core.setOutput('ref', sourceSettings.ref)
|
||||||
} finally {
|
} finally {
|
||||||
// Unregister problem matcher
|
// Unregister problem matcher
|
||||||
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
|
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
|
||||||
|
Loading…
Reference in New Issue
Block a user