mirror of
https://github.com/actions/checkout.git
synced 2025-03-14 10:07:00 +00:00
Add ref output to action
This value is the SHA1 commit of the repository ref that was actually checked out.
This commit is contained in:
parent
c5ef344f79
commit
dbd025a70e
4 changed files with 10 additions and 3 deletions
|
@ -86,6 +86,11 @@ inputs:
|
||||||
long-paths:
|
long-paths:
|
||||||
description: Enable core.longpath support
|
description: Enable core.longpath support
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
|
output:
|
||||||
|
ref:
|
||||||
|
description: The SHA1 ref that was checked out
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node16
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
|
3
dist/index.js
vendored
3
dist/index.js
vendored
|
@ -32007,7 +32007,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 commit = yield git.log1("--format='%H'");
|
||||||
|
core.setOutput('ref', commit.replaceAll("'", '').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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,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 commit = await git.log1("--format='%H'")
|
||||||
|
core.setOutput('ref', commit.replaceAll("'", '').trim())
|
||||||
|
|
||||||
// Check for incorrect pull request merge commit
|
// Check for incorrect pull request merge commit
|
||||||
await refHelper.checkCommitInfo(
|
await refHelper.checkCommitInfo(
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6"
|
"es2021"
|
||||||
],
|
],
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
|
|
Loading…
Add table
Reference in a new issue