Skip to content

Commit

Permalink
Use latest buildx for git context test
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Aug 16, 2020
1 parent 9c47365 commit 1c3fedb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ async function getBuildContext(): Promise<string> {
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;
}
Expand Down

0 comments on commit 1c3fedb

Please sign in to comment.