From 1c3fedb652785915c6e815ec81ea1d7b43c76ea5 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 16 Aug 2020 19:22:14 +0200 Subject: [PATCH] Use latest buildx for git context test Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 9 +++++---- dist/index.js | 10 ++++++---- src/context.ts | 10 ++++++---- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b6ccb3..6043533 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,14 +76,15 @@ jobs: name: Set up Docker Buildx id: buildx uses: ./setup-buildx/ # change to docker/setup-buildx-action@master -# with: -# driver-opt: network=host + with: + version: latest + #driver-opt: network=host - name: Build and push uses: ./ env: - GITHUB_TOKEN: ${{ github.token }} - GITHUB_REF: ${{ github.ref }} + GIT_AUTH_TOKEN: ${{ github.token }} + GIT_REF: ${{ github.ref }} with: context: ${{ github.repositoryUrl }} file: ./test/Dockerfile diff --git a/dist/index.js b/dist/index.js index aad4fb9..129fa89 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1912,10 +1912,12 @@ function getBuildContext() { return '.'; } try { - const gitURL = git_url_parse_1.default(context); - gitURL.token = gitURL.token || process.env['GIT_TOKEN'] || process.env['GITHUB_TOKEN'] || ''; - gitURL.ref = gitURL.ref || process.env['GIT_REF'] || process.env['GITHUB_REF'] || ''; - return gitURL.toString(); + const gitUrl = git_url_parse_1.default(context); + const gitRef = process.env['GIT_REF'] || ''; + if (gitRef) { + return `${gitUrl.toString()}#${gitRef}`; + } + return gitUrl.toString(); } catch (_a) { return context; diff --git a/src/context.ts b/src/context.ts index 5947192..693b725 100644 --- a/src/context.ts +++ b/src/context.ts @@ -72,10 +72,12 @@ async function getBuildContext(): Promise { return '.'; } try { - const gitURL = gitUrlParse(context); - gitURL.token = gitURL.token || process.env['GIT_TOKEN'] || process.env['GITHUB_TOKEN'] || ''; - gitURL.ref = gitURL.ref || process.env['GIT_REF'] || process.env['GITHUB_REF'] || ''; - return gitURL.toString(); + const gitUrl = gitUrlParse(context); + const gitRef = process.env['GIT_REF'] || ''; + if (gitRef) { + return `${gitUrl.toString()}#${gitRef}`; + } + return gitUrl.toString(); } catch { return context; }