1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-04-23 07:06:37 +02:00

Merge pull request #347 from crazy-max/fix-ref-spec

Fix ref spec for default Git context
This commit is contained in:
CrazyMax 2021-05-26 13:00:32 +02:00 committed by GitHub
commit 74242a33cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 15 deletions

10
dist/index.js generated vendored
View file

@ -13401,9 +13401,15 @@ const github = __importStar(__webpack_require__(438));
const buildx = __importStar(__webpack_require__(295));
let _defaultContext, _tmpDir;
function defaultContext() {
var _a, _b;
if (!_defaultContext) {
_defaultContext = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${github.context.repo.repo}.git#${(_b = (_a = github.context) === null || _a === void 0 ? void 0 : _a.ref) === null || _b === void 0 ? void 0 : _b.replace(/^refs\//, '')}`;
let ref = github.context.ref;
if (github.context.sha && ref && !ref.startsWith('refs/')) {
ref = `refs/heads/${github.context.ref}`;
}
if (github.context.sha && !ref.startsWith(`refs/pull/`)) {
ref = github.context.sha;
}
_defaultContext = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${github.context.repo.repo}.git#${ref}`;
}
return _defaultContext;
}