Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
e7819bbe91 chore(deps): Bump @docker/actions-toolkit from 0.68.0 to 0.77.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.68.0 to 0.77.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.68.0...v0.77.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-version: 0.77.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-03 20:24:25 +00:00
7 changed files with 437 additions and 707 deletions

View File

@@ -1,4 +1,5 @@
import {beforeEach, describe, expect, test, it, vi} from 'vitest';
import {Context} from '@actions/github/lib/context.js';
import {Git} from '@docker/actions-toolkit/lib/git.js';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
@@ -97,11 +98,11 @@ describe('getContext', () => {
expect(ctx.commitDate).toEqual(new Date('2024-11-13T13:42:28.000Z'));
});
it('git', async () => {
vi.spyOn(Git, 'context').mockImplementation((): Promise<context.Context> => {
vi.spyOn(Git, 'context').mockImplementation((): Promise<Context> => {
return Promise.resolve({
ref: 'refs/heads/git-test',
sha: 'git-test-sha'
} as context.Context);
} as Context);
});
vi.spyOn(Git, 'commitDate').mockImplementation(async (): Promise<Date> => {
return new Date('2023-01-01T13:42:28.000Z');

View File

@@ -3,12 +3,12 @@ import * as fs from 'fs';
import * as path from 'path';
import * as dotenv from 'dotenv';
import {Context} from '@actions/github/lib/context.js';
import {GitHub} from '@docker/actions-toolkit/lib/github.js';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github.js';
import {ContextSource, getContext, getInputs, Inputs} from '../src/context.js';
import type {Context as MetadataContext} from '../src/context.js';
import {Meta, Version} from '../src/meta.js';
import repoFixture from './fixtures/repo.json' with {type: 'json'};
@@ -38,28 +38,16 @@ beforeEach(() => {
delete process.env[key];
}
});
vi.spyOn(GitHub, 'context', 'get').mockImplementation((): MetadataContext => {
const repository = process.env.GITHUB_REPOSITORY || 'docker/repo';
const [owner, repo] = repository.includes('/') ? repository.split('/', 2) : ['docker', 'repo'];
const eventPath = process.env.GITHUB_EVENT_PATH;
const payload = eventPath && fs.existsSync(eventPath) ? JSON.parse(fs.readFileSync(eventPath, 'utf8')) : {};
vi.spyOn(GitHub, 'context', 'get').mockImplementation((): Context => {
//@ts-expect-error partial info
return {
payload,
eventName: process.env.GITHUB_EVENT_NAME || '',
sha: process.env.GITHUB_SHA || '',
ref: process.env.GITHUB_REF || '',
workflow: process.env.GITHUB_WORKFLOW || '',
action: process.env.GITHUB_ACTION || '',
actor: process.env.GITHUB_ACTOR || '',
job: process.env.GITHUB_JOB || '',
runAttempt: +(process.env.GITHUB_RUN_ATTEMPT || 1),
runNumber: +(process.env.GITHUB_RUN_NUMBER || 0),
runId: +(process.env.GITHUB_RUN_ID || 0),
apiUrl: process.env.GITHUB_API_URL || 'https://api.github.com',
serverUrl: process.env.GITHUB_SERVER_URL || 'https://github.com',
graphqlUrl: process.env.GITHUB_GRAPHQL_URL || 'https://api.github.com/graphql',
repo: {owner, repo}
} as MetadataContext;
...new Context(),
repo: {
owner: 'docker',
repo: 'repo'
}
};
});
});

82
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

@@ -25,8 +25,8 @@
"packageManager": "yarn@4.9.2",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@docker/actions-toolkit": "^0.68.0",
"@actions/github": "^6.0.1",
"@docker/actions-toolkit": "^0.77.0",
"@renovate/pep440": "^1.0.0",
"csv-parse": "^6.1.0",
"handlebars": "^4.7.8",

View File

@@ -1,12 +1,11 @@
import * as core from '@actions/core';
import {Context as GithubContext} from '@actions/github/lib/context.js';
import {Util} from '@docker/actions-toolkit/lib/util.js';
import {Git} from '@docker/actions-toolkit/lib/git.js';
import {GitHub} from '@docker/actions-toolkit/lib/github.js';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit.js';
type GithubContext = typeof GitHub.context;
export interface Context extends GithubContext {
commitDate: Date;
}

1016
yarn.lock

File diff suppressed because it is too large Load Diff