From c24a92baa45c5e94ea4f378525cfa5159e01c021 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 3 Oct 2020 22:26:00 +0200 Subject: [PATCH] Fix Git context Signed-off-by: CrazyMax --- README.md | 2 +- action.yml | 1 - dist/index.js | 2 +- src/context.ts | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 37682a5..0e7e3b4 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ build-secrets, remote cache, etc. and different builder deployment/namespacing o ### Git context -The default behavior of this action is to use the [Git context invoked by your workflow](https://github.com/docker/build-push-action/blob/master/src/context.ts#L35). +The default behavior of this action is to use the [Git context invoked by your workflow](https://github.com/docker/build-push-action/blob/master/src/context.ts#L10). ```yaml name: ci diff --git a/action.yml b/action.yml index ec7feb8..f13442c 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,6 @@ inputs: context: description: "Build's context is the set of files located in the specified PATH or URL" required: false - default: '.' file: description: "Path to the Dockerfile" required: false diff --git a/dist/index.js b/dist/index.js index a07fc96..b230ccf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13712,7 +13712,7 @@ const buildx = __importStar(__webpack_require__(295)); const core = __importStar(__webpack_require__(186)); const github = __importStar(__webpack_require__(438)); exports.tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-build-push-')); -const defaultContext = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}#${github.context.ref}`; +const defaultContext = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}.git#${github.context.ref.replace(/^refs\//, '')}`; function getInputs() { return __awaiter(this, void 0, void 0, function* () { return { diff --git a/src/context.ts b/src/context.ts index 98eef07..b090ff4 100644 --- a/src/context.ts +++ b/src/context.ts @@ -7,7 +7,9 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; export const tmpDir: string = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-build-push-')); -const defaultContext: string = `https://github.com/${github.context.repo.owner}/${github.context.repo.repo}#${github.context.ref}`; +const defaultContext: string = `https://github.com/${github.context.repo.owner}/${ + github.context.repo.repo +}.git#${github.context.ref.replace(/^refs\//, '')}`; export interface Inputs { context: string;