Compare commits

..

3 Commits

Author SHA1 Message Date
CrazyMax
e5665a8005 documentation for scope input
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-01-07 15:50:21 +01:00
CrazyMax
580c4eb563 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-01-07 15:50:21 +01:00
CrazyMax
4850ca5e15 Add scope input to set scopes for the authentication token
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-01-07 15:50:20 +01:00
4 changed files with 5 additions and 14 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,6 @@ import * as core from '@actions/core';
import * as yaml from 'js-yaml';
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx';
import {Util} from '@docker/actions-toolkit/lib/util';
export interface Inputs {
registry: string;
@@ -70,7 +69,7 @@ export function getAuthList(inputs: Inputs): Array<Auth> {
}
export function scopeToConfigDir(registry: string, scope?: string): string {
if (scopeDisabled() || !scope || scope === '') {
if (!scope || scope === '') {
return '';
}
let configDir = path.join(Buildx.configDir, 'config', registry === 'docker.io' ? 'registry-1.docker.io' : registry);
@@ -81,10 +80,3 @@ export function scopeToConfigDir(registry: string, scope?: string): string {
}
return configDir;
}
function scopeDisabled(): boolean {
if (process.env.DOCKER_LOGIN_SCOPE_DISABLED) {
return Util.parseBool(process.env.DOCKER_LOGIN_SCOPE_DISABLED);
}
return false;
}

View File

@@ -56,10 +56,9 @@ export async function loginECR(registry: string, username: string, password: str
async function loginExec(registry: string, username: string, password: string, scope?: string): Promise<void> {
let envs: {[key: string]: string} | undefined;
const configDir = context.scopeToConfigDir(registry, scope);
if (configDir !== '') {
if (scope && scope !== '') {
envs = Object.assign({}, process.env, {
DOCKER_CONFIG: configDir
DOCKER_CONFIG: context.scopeToConfigDir(registry, scope)
}) as {
[key: string]: string;
};