mirror of
https://github.com/docker/login-action.git
synced 2026-03-26 17:01:07 +08:00
Compare commits
2 Commits
master
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb438a070f | ||
|
|
8c0a7ae7d8 |
37
.github/workflows/codeql.yml
vendored
37
.github/workflows/codeql.yml
vendored
@@ -5,41 +5,46 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/codeql.yml'
|
||||||
|
- 'dist/**'
|
||||||
|
- 'src/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/codeql.yml'
|
||||||
|
- 'dist/**'
|
||||||
|
- 'src/**'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
security-events: write
|
||||||
|
|
||||||
env:
|
|
||||||
NODE_VERSION: "24"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language:
|
||||||
|
- javascript-typescript
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
-
|
|
||||||
name: Enable corepack
|
|
||||||
run: |
|
|
||||||
corepack enable
|
|
||||||
yarn --version
|
|
||||||
-
|
|
||||||
name: Set up Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
-
|
-
|
||||||
name: Initialize CodeQL
|
name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v4
|
uses: github/codeql-action/init@v4
|
||||||
with:
|
with:
|
||||||
languages: javascript-typescript
|
languages: ${{ matrix.language }}
|
||||||
build-mode: none
|
config: |
|
||||||
|
paths:
|
||||||
|
- src
|
||||||
|
-
|
||||||
|
name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v4
|
||||||
-
|
-
|
||||||
name: Perform CodeQL Analysis
|
name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v4
|
uses: github/codeql-action/analyze@v4
|
||||||
with:
|
with:
|
||||||
category: "/language:javascript-typescript"
|
category: "/language:${{matrix.language}}"
|
||||||
|
|||||||
2
.github/workflows/pr-assign-author.yml
vendored
2
.github/workflows/pr-assign-author.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@20ef82212dc54bab5749f5e05576ca6d3c8a5773 # v1.1.0
|
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
import {afterEach, expect, test} from 'vitest';
|
import {expect, test} from 'vitest';
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import {Buildx} from '@docker/actions-toolkit/lib/buildx/buildx.js';
|
import {getInputs} from '../src/context.js';
|
||||||
|
|
||||||
import {getAuthList, getInputs} from '../src/context.js';
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
for (const key of Object.keys(process.env)) {
|
|
||||||
if (key.startsWith('INPUT_')) {
|
|
||||||
delete process.env[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('with password and username getInputs does not throw error', async () => {
|
test('with password and username getInputs does not throw error', async () => {
|
||||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
process.env['INPUT_USERNAME'] = 'dbowie';
|
||||||
@@ -21,15 +10,3 @@ test('with password and username getInputs does not throw error', async () => {
|
|||||||
getInputs();
|
getInputs();
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getAuthList uses the default Docker Hub registry when computing scoped config dir', async () => {
|
|
||||||
process.env['INPUT_USERNAME'] = 'dbowie';
|
|
||||||
process.env['INPUT_PASSWORD'] = 'groundcontrol';
|
|
||||||
process.env['INPUT_SCOPE'] = 'myscope';
|
|
||||||
process.env['INPUT_LOGOUT'] = 'false';
|
|
||||||
const [auth] = getAuthList(getInputs());
|
|
||||||
expect(auth).toMatchObject({
|
|
||||||
registry: 'docker.io',
|
|
||||||
configDir: path.join(Buildx.configDir, 'config', 'registry-1.docker.io', 'myscope')
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import {expect, test, vi} from 'vitest';
|
import {expect, test, vi} from 'vitest';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
|
||||||
|
|
||||||
import {loginStandard, logout} from '../src/docker.js';
|
import {loginStandard, logout} from '../src/docker.js';
|
||||||
|
|
||||||
|
process.env['RUNNER_TEMP'] = path.join(__dirname, 'runner');
|
||||||
|
|
||||||
test('loginStandard calls exec', async () => {
|
test('loginStandard calls exec', async () => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
||||||
return {
|
return {
|
||||||
exitCode: expect.any(Number),
|
exitCode: expect.any(Number),
|
||||||
@@ -33,6 +38,8 @@ test('loginStandard calls exec', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('logout calls exec', async () => {
|
test('logout calls exec', async () => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
const execSpy = vi.spyOn(Docker, 'getExecOutput').mockImplementation(async () => {
|
||||||
return {
|
return {
|
||||||
exitCode: expect.any(Number),
|
exitCode: expect.any(Number),
|
||||||
|
|||||||
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -42,26 +42,24 @@ export function getAuthList(inputs: Inputs): Array<Auth> {
|
|||||||
}
|
}
|
||||||
let auths: Array<Auth> = [];
|
let auths: Array<Auth> = [];
|
||||||
if (!inputs.registryAuth) {
|
if (!inputs.registryAuth) {
|
||||||
const registry = inputs.registry || 'docker.io';
|
|
||||||
auths.push({
|
auths.push({
|
||||||
registry,
|
registry: inputs.registry || 'docker.io',
|
||||||
username: inputs.username,
|
username: inputs.username,
|
||||||
password: inputs.password,
|
password: inputs.password,
|
||||||
scope: inputs.scope,
|
scope: inputs.scope,
|
||||||
ecr: inputs.ecr || 'auto',
|
ecr: inputs.ecr || 'auto',
|
||||||
configDir: scopeToConfigDir(registry, inputs.scope)
|
configDir: scopeToConfigDir(inputs.registry, inputs.scope)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
auths = (yaml.load(inputs.registryAuth) as Array<Auth>).map(auth => {
|
auths = (yaml.load(inputs.registryAuth) as Array<Auth>).map(auth => {
|
||||||
core.setSecret(auth.password); // redacted in workflow logs
|
core.setSecret(auth.password); // redacted in workflow logs
|
||||||
const registry = auth.registry || 'docker.io';
|
|
||||||
return {
|
return {
|
||||||
registry,
|
registry: auth.registry || 'docker.io',
|
||||||
username: auth.username,
|
username: auth.username,
|
||||||
password: auth.password,
|
password: auth.password,
|
||||||
scope: auth.scope,
|
scope: auth.scope,
|
||||||
ecr: auth.ecr || 'auto',
|
ecr: auth.ecr || 'auto',
|
||||||
configDir: scopeToConfigDir(registry, auth.scope)
|
configDir: scopeToConfigDir(auth.registry || 'docker.io', auth.scope)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
86
yarn.lock
86
yarn.lock
@@ -2892,6 +2892,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"brace-expansion@npm:^2.0.2":
|
||||||
|
version: 2.0.2
|
||||||
|
resolution: "brace-expansion@npm:2.0.2"
|
||||||
|
dependencies:
|
||||||
|
balanced-match: "npm:^1.0.0"
|
||||||
|
checksum: 10/01dff195e3646bc4b0d27b63d9bab84d2ebc06121ff5013ad6e5356daa5a9d6b60fa26cf73c74797f2dc3fbec112af13578d51f75228c1112b26c790a87b0488
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"brace-expansion@npm:^5.0.2":
|
"brace-expansion@npm:^5.0.2":
|
||||||
version: 5.0.4
|
version: 5.0.4
|
||||||
resolution: "brace-expansion@npm:5.0.4"
|
resolution: "brace-expansion@npm:5.0.4"
|
||||||
@@ -3639,9 +3648,9 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"flatted@npm:^3.2.9":
|
"flatted@npm:^3.2.9":
|
||||||
version: 3.4.2
|
version: 3.3.3
|
||||||
resolution: "flatted@npm:3.4.2"
|
resolution: "flatted@npm:3.3.3"
|
||||||
checksum: 10/a9e78fe5c2c1fcd98209a015ccee3a6caa953e01729778e83c1fe92e68601a63e1e69cd4e573010ca99eaf585a581b80ccf1018b99283e6cbc2117bcba1e030f
|
checksum: 10/8c96c02fbeadcf4e8ffd0fa24983241e27698b0781295622591fc13585e2f226609d95e422bcf2ef044146ffacb6b68b1f20871454eddf75ab3caa6ee5f4a1fe
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -3701,33 +3710,19 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"glob@npm:^10.0.0":
|
"glob@npm:^10.0.0, glob@npm:^10.2.2, glob@npm:^10.3.10":
|
||||||
version: 10.3.15
|
version: 10.5.0
|
||||||
resolution: "glob@npm:10.3.15"
|
resolution: "glob@npm:10.5.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
foreground-child: "npm:^3.1.0"
|
foreground-child: "npm:^3.1.0"
|
||||||
jackspeak: "npm:^2.3.6"
|
jackspeak: "npm:^3.1.2"
|
||||||
minimatch: "npm:^9.0.1"
|
minimatch: "npm:^9.0.4"
|
||||||
minipass: "npm:^7.0.4"
|
minipass: "npm:^7.1.2"
|
||||||
path-scurry: "npm:^1.11.0"
|
package-json-from-dist: "npm:^1.0.0"
|
||||||
|
path-scurry: "npm:^1.11.1"
|
||||||
bin:
|
bin:
|
||||||
glob: dist/esm/bin.mjs
|
glob: dist/esm/bin.mjs
|
||||||
checksum: 10/b2b1c74309979b34fd6010afb50418a12525def32f1d3758d5827fc75d6143fc3ee5d1f3180a43111f6386c9e297c314f208d9d09955a6c6b69f22e92ee97635
|
checksum: 10/ab3bccfefcc0afaedbd1f480cd0c4a2c0e322eb3f0aa7ceaa31b3f00b825069f17cf0f1fc8b6f256795074b903f37c0ade37ddda6a176aa57f1c2bbfe7240653
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"glob@npm:^10.2.2, glob@npm:^10.3.10":
|
|
||||||
version: 10.3.12
|
|
||||||
resolution: "glob@npm:10.3.12"
|
|
||||||
dependencies:
|
|
||||||
foreground-child: "npm:^3.1.0"
|
|
||||||
jackspeak: "npm:^2.3.6"
|
|
||||||
minimatch: "npm:^9.0.1"
|
|
||||||
minipass: "npm:^7.0.4"
|
|
||||||
path-scurry: "npm:^1.10.2"
|
|
||||||
bin:
|
|
||||||
glob: dist/esm/bin.mjs
|
|
||||||
checksum: 10/9e8186abc22dc824b5dd86cefd8e6b5621a72d1be7f68bacc0fd681e8c162ec5546660a6ec0553d6a74757a585e655956c7f8f1a6d24570e8d865c307323d178
|
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -4046,16 +4041,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"jackspeak@npm:^2.3.6":
|
"jackspeak@npm:^3.1.2":
|
||||||
version: 2.3.6
|
version: 3.4.3
|
||||||
resolution: "jackspeak@npm:2.3.6"
|
resolution: "jackspeak@npm:3.4.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@isaacs/cliui": "npm:^8.0.2"
|
"@isaacs/cliui": "npm:^8.0.2"
|
||||||
"@pkgjs/parseargs": "npm:^0.11.0"
|
"@pkgjs/parseargs": "npm:^0.11.0"
|
||||||
dependenciesMeta:
|
dependenciesMeta:
|
||||||
"@pkgjs/parseargs":
|
"@pkgjs/parseargs":
|
||||||
optional: true
|
optional: true
|
||||||
checksum: 10/6e6490d676af8c94a7b5b29b8fd5629f21346911ebe2e32931c2a54210134408171c24cee1a109df2ec19894ad04a429402a8438cbf5cc2794585d35428ace76
|
checksum: 10/96f8786eaab98e4bf5b2a5d6d9588ea46c4d06bbc4f2eb861fdd7b6b182b16f71d8a70e79820f335d52653b16d4843b29dd9cdcf38ae80406756db9199497cf3
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -4315,12 +4310,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"minimatch@npm:^9.0.1":
|
"minimatch@npm:^9.0.4":
|
||||||
version: 9.0.4
|
version: 9.0.9
|
||||||
resolution: "minimatch@npm:9.0.4"
|
resolution: "minimatch@npm:9.0.9"
|
||||||
dependencies:
|
dependencies:
|
||||||
brace-expansion: "npm:^2.0.1"
|
brace-expansion: "npm:^2.0.2"
|
||||||
checksum: 10/4cdc18d112b164084513e890d6323370db14c22249d536ad1854539577a895e690a27513dc346392f61a4a50afbbd8abc88f3f25558bfbbbb862cd56508b20f5
|
checksum: 10/b91fad937deaffb68a45a2cb731ff3cff1c3baf9b6469c879477ed16f15c8f4ce39d63a3f75c2455107c2fdff0f3ab597d97dc09e2e93b883aafcf926ef0c8f9
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -4413,7 +4408,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4":
|
"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3":
|
||||||
version: 7.1.0
|
version: 7.1.0
|
||||||
resolution: "minipass@npm:7.1.0"
|
resolution: "minipass@npm:7.1.0"
|
||||||
checksum: 10/0cfc1bc95bfce2a0cf69fcb5e7b92f62ee7159f2787356e66b5804dba73546e1653bbc70bf9bb32acb031e6d0d4b6249628a014644a597a7e4a14b441a510ba5
|
checksum: 10/0cfc1bc95bfce2a0cf69fcb5e7b92f62ee7159f2787356e66b5804dba73546e1653bbc70bf9bb32acb031e6d0d4b6249628a014644a597a7e4a14b441a510ba5
|
||||||
@@ -4619,6 +4614,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"package-json-from-dist@npm:^1.0.0":
|
||||||
|
version: 1.0.1
|
||||||
|
resolution: "package-json-from-dist@npm:1.0.1"
|
||||||
|
checksum: 10/58ee9538f2f762988433da00e26acc788036914d57c71c246bf0be1b60cdbd77dd60b6a3e1a30465f0b248aeb80079e0b34cb6050b1dfa18c06953bb1cbc7602
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"pako@npm:~0.2.0":
|
"pako@npm:~0.2.0":
|
||||||
version: 0.2.9
|
version: 0.2.9
|
||||||
resolution: "pako@npm:0.2.9"
|
resolution: "pako@npm:0.2.9"
|
||||||
@@ -4649,17 +4651,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"path-scurry@npm:^1.10.2":
|
"path-scurry@npm:^1.11.1":
|
||||||
version: 1.10.2
|
|
||||||
resolution: "path-scurry@npm:1.10.2"
|
|
||||||
dependencies:
|
|
||||||
lru-cache: "npm:^10.2.0"
|
|
||||||
minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0"
|
|
||||||
checksum: 10/a2bbbe8dc284c49dd9be78ca25f3a8b89300e0acc24a77e6c74824d353ef50efbf163e64a69f4330b301afca42d0e2229be0560d6d616ac4e99d48b4062016b1
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"path-scurry@npm:^1.11.0":
|
|
||||||
version: 1.11.1
|
version: 1.11.1
|
||||||
resolution: "path-scurry@npm:1.11.1"
|
resolution: "path-scurry@npm:1.11.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user