Compare commits

..

5 Commits

Author SHA1 Message Date
CrazyMax
7b19fec715
Merge pull request #604 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.77.0
Some checks failed
ci / tag-schedule () (push) Has been cancelled
ci / tag-schedule (cron-{{date 'YYYYMMDD'}}) (push) Has been cancelled
ci / tag-schedule (schedule) (push) Has been cancelled
ci / tag-schedule ({{date 'YYYYMMDD-HHmmss'}}) (push) Has been cancelled
ci / tag-match (\d.\d, 0) (push) Has been cancelled
ci / tag-match (\d.\d.\d, 0) (push) Has been cancelled
ci / tag-match (v(.*), 1) (push) Has been cancelled
ci / tag-semver (auto) (push) Has been cancelled
ci / tag-semver (false) (push) Has been cancelled
ci / tag-semver (true) (push) Has been cancelled
ci / flavor (push) Has been cancelled
ci / images (push) Has been cancelled
ci / custom-labels-annotations (push) Has been cancelled
ci / global-exps (push) Has been cancelled
ci / json (push) Has been cancelled
ci / docker-push (push) Has been cancelled
ci / bake (push) Has been cancelled
ci / sep-tags ( ) (push) Has been cancelled
ci / sep-tags (,) (push) Has been cancelled
ci / output-env (push) Has been cancelled
ci / no-output-env (push) Has been cancelled
ci / bake-annotations (push) Has been cancelled
ci / no-images (push) Has been cancelled
ci / bake-path-context (push) Has been cancelled
ci / sha-short () (push) Has been cancelled
ci / sha-short (16) (push) Has been cancelled
ci / dump (push) Has been cancelled
test / test (push) Has been cancelled
validate / prepare (push) Has been cancelled
validate / validate (push) Has been cancelled
chore(deps): Bump @docker/actions-toolkit from 0.68.0 to 0.79.0
2026-03-05 17:00:40 +01:00
CrazyMax
281c9b0599
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-05 09:24:56 +01:00
CrazyMax
5f43b3b4f4
test: stabilize github mock setup since ESM
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-05 09:23:56 +01:00
CrazyMax
9d53276575
github class moved since actions-toolkit v0.77.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-05 09:23:56 +01:00
dependabot[bot]
eaa3d3973e
chore(deps): Bump @docker/actions-toolkit from 0.68.0 to 0.77.0
Dependabot couldn't find the original pull request head commit, cdad825a9dc17122e84ab473271a55d7b8b3da06.
2026-03-05 08:21:31 +00:00
8 changed files with 633 additions and 1242 deletions

View File

@ -3,9 +3,9 @@ import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import * as dotenv from 'dotenv'; import * as dotenv from 'dotenv';
import {GitHub} from '@docker/actions-toolkit/lib/github.js'; import {GitHub} from '@docker/actions-toolkit/lib/github/github.js';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js'; import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github.js'; import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github/github.js';
import {ContextSource, getContext, getInputs, Inputs} from '../src/context.js'; import {ContextSource, getContext, getInputs, Inputs} from '../src/context.js';
import type {Context as MetadataContext} from '../src/context.js'; import type {Context as MetadataContext} from '../src/context.js';

View File

@ -1,32 +1,11 @@
import fs from 'node:fs'; import fs from 'node:fs';
import {createRequire} from 'node:module';
import os from 'node:os'; import os from 'node:os';
import path from 'node:path'; import path from 'node:path';
import {vi} from 'vitest'; import {vi} from 'vitest';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')); const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-'));
process.env = Object.assign({}, process.env, { const githubPayload = {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/metadata-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
});
const require = createRequire(import.meta.url);
type RequireCacheEntry = NonNullable<(typeof require.cache)[string]>;
const githubMock = {
context: {
repo: {
owner: 'docker',
repo: 'actions-toolkit'
},
ref: 'refs/heads/dev',
sha: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
runId: 2188748038,
runNumber: 15,
payload: {
after: '860c1904a1ce19322e91ac35af1ab07466440c37', after: '860c1904a1ce19322e91ac35af1ab07466440c37',
base_ref: null, base_ref: null,
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a', before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
@ -43,11 +22,11 @@ const githubMock = {
username: 'crazy-max' username: 'crazy-max'
}, },
distinct: true, distinct: true,
id: '860c1904a1ce19322e91ac35af1ab07466440c37', id: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
message: 'hello dev', message: 'hello dev',
timestamp: '2022-04-19T11:27:24+02:00', timestamp: '2024-11-13T13:42:28Z',
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820', tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37' url: 'https://github.com/docker/test-docker-action/commit/5f3331d7f7044c18ca9f12c77d961c4d7cf3276a'
} }
], ],
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce', compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
@ -66,11 +45,11 @@ const githubMock = {
username: 'crazy-max' username: 'crazy-max'
}, },
distinct: true, distinct: true,
id: '860c1904a1ce19322e91ac35af1ab07466440c37', id: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
message: 'hello dev', message: 'hello dev',
timestamp: '2022-04-19T11:27:24+02:00', timestamp: '2024-11-13T13:42:28Z',
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820', tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37' url: 'https://github.com/docker/test-docker-action/commit/5f3331d7f7044c18ca9f12c77d961c4d7cf3276a'
}, },
organization: { organization: {
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4', avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
@ -220,12 +199,26 @@ const githubMock = {
type: 'User', type: 'User',
url: 'https://api.github.com/users/crazy-max' url: 'https://api.github.com/users/crazy-max'
} }
} };
},
getOctokit: () => ({ const githubEventPath = path.join(tmpDir, 'github-event.json');
rest: { fs.writeFileSync(githubEventPath, JSON.stringify(githubPayload));
repos: {
getCommit: async () => ({ process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/metadata-action',
GITHUB_REF: 'refs/heads/dev',
GITHUB_RUN_ID: '2188748038',
GITHUB_RUN_ATTEMPT: '1',
GITHUB_RUN_NUMBER: '15',
GITHUB_SHA: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
GITHUB_EVENT_PATH: githubEventPath,
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
});
const getCommitMock = vi.hoisted(() =>
vi.fn(async () => ({
data: { data: {
commit: { commit: {
committer: { committer: {
@ -233,27 +226,27 @@ const githubMock = {
} }
} }
} }
}) }))
);
const getOctokitMock = vi.hoisted(() =>
vi.fn(() => ({
rest: {
repos: {
getCommit: getCommitMock
} }
} }
}) }))
);
vi.mock('@actions/github', async importOriginal => {
const actual = await importOriginal<typeof import('@actions/github')>();
return {
...actual,
context: {
...actual.context,
payload: githubPayload
},
getOctokit: getOctokitMock
}; };
});
vi.mock('@actions/github', () => githubMock);
for (const mod of ['@actions/github', '@docker/actions-toolkit/node_modules/@actions/github']) {
try {
const resolved = require.resolve(mod);
vi.doMock(resolved, () => githubMock);
require.cache[resolved] = {
id: resolved,
filename: resolved,
loaded: true,
exports: githubMock,
children: [],
paths: []
} as RequireCacheEntry;
} catch {
// Ignore unresolved optional paths; vi.mock handles module-level mocking.
}
}

145
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

@ -26,7 +26,7 @@
"dependencies": { "dependencies": {
"@actions/core": "^3.0.0", "@actions/core": "^3.0.0",
"@actions/github": "^9.0.0", "@actions/github": "^9.0.0",
"@docker/actions-toolkit": "^0.68.0", "@docker/actions-toolkit": "^0.79.0",
"@renovate/pep440": "^1.0.0", "@renovate/pep440": "^1.0.0",
"csv-parse": "^6.1.0", "csv-parse": "^6.1.0",
"handlebars": "^4.7.8", "handlebars": "^4.7.8",

View File

@ -2,7 +2,7 @@ import * as core from '@actions/core';
import {Util} from '@docker/actions-toolkit/lib/util.js'; import {Util} from '@docker/actions-toolkit/lib/util.js';
import {Git} from '@docker/actions-toolkit/lib/git.js'; import {Git} from '@docker/actions-toolkit/lib/git.js';
import {GitHub} from '@docker/actions-toolkit/lib/github.js'; import {GitHub} from '@docker/actions-toolkit/lib/github/github.js';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js'; import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
type GithubContext = typeof GitHub.context; type GithubContext = typeof GitHub.context;

View File

@ -6,7 +6,7 @@ import * as pep440 from '@renovate/pep440';
import * as semver from 'semver'; import * as semver from 'semver';
import * as core from '@actions/core'; import * as core from '@actions/core';
import {Context as ToolkitContext} from '@docker/actions-toolkit/lib/context.js'; import {Context as ToolkitContext} from '@docker/actions-toolkit/lib/context.js';
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github.js'; import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github/github.js';
import {Inputs, Context} from './context.js'; import {Inputs, Context} from './context.js';
import * as icl from './image.js'; import * as icl from './image.js';

1251
yarn.lock

File diff suppressed because it is too large Load Diff