mirror of
https://github.com/docker/metadata-action.git
synced 2026-01-10 06:23:08 +08:00
Compare commits
7 Commits
5ce969f9be
...
8f8de6ac4e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f8de6ac4e | ||
|
|
ed95091677 | ||
|
|
57670b6268 | ||
|
|
d636a41a2f | ||
|
|
9c747a7ed1 | ||
|
|
c98baa7757 | ||
|
|
ad1f8b1f99 |
@ -1,3 +0,0 @@
|
|||||||
/dist/**
|
|
||||||
/coverage/**
|
|
||||||
/node_modules/**
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:jest/recommended",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 2023,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -2770,7 +2770,6 @@ describe('pr', () => {
|
|||||||
|
|
||||||
describe('pr-head-sha', () => {
|
describe('pr-head-sha', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
'pr01',
|
'pr01',
|
||||||
@ -3911,7 +3910,6 @@ describe('raw', () => {
|
|||||||
|
|
||||||
describe('json', () => {
|
describe('json', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
'json01',
|
'json01',
|
||||||
@ -4275,7 +4273,6 @@ describe('json', () => {
|
|||||||
|
|
||||||
describe('bakeFile', () => {
|
describe('bakeFile', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
'bakeFile01',
|
'bakeFile01',
|
||||||
@ -4797,7 +4794,6 @@ describe('bakeFile', () => {
|
|||||||
|
|
||||||
describe('bakeFileTagsLabels', () => {
|
describe('bakeFileTagsLabels', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
'bakeFileTagsLabels01',
|
'bakeFileTagsLabels01',
|
||||||
@ -4855,7 +4851,6 @@ describe('bakeFileTagsLabels', () => {
|
|||||||
|
|
||||||
describe('sepTags', () => {
|
describe('sepTags', () => {
|
||||||
// prettier-ignore
|
// prettier-ignore
|
||||||
// eslint-disable-next-line jest/expect-expect
|
|
||||||
test.each([
|
test.each([
|
||||||
[
|
[
|
||||||
'sepTags01',
|
'sepTags01',
|
||||||
@ -4888,13 +4883,10 @@ describe('sepTags', () => {
|
|||||||
"user/app:dev,user/app:my,user/app:custom,user/app:tags"
|
"user/app:dev,user/app:my,user/app:custom,user/app:tags"
|
||||||
]
|
]
|
||||||
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, expTags: string) => {
|
])('given %p with %p event', async (name: string, envFile: string, inputs: Inputs, expTags: string) => {
|
||||||
|
|
||||||
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
process.env = dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures', envFile)));
|
||||||
|
|
||||||
const toolkit = new Toolkit();
|
const toolkit = new Toolkit();
|
||||||
|
|
||||||
const repo = await toolkit.github.repoData();
|
const repo = await toolkit.github.repoData();
|
||||||
|
|
||||||
const meta = new Meta({...getInputs(), ...inputs}, await getContext(ContextSource.workflow, toolkit), repo);
|
const meta = new Meta({...getInputs(), ...inputs}, await getContext(ContextSource.workflow, toolkit), repo);
|
||||||
|
|
||||||
expect(meta.getTags().join(inputs.sepTags)).toEqual(expTags);
|
expect(meta.getTags().join(inputs.sepTags)).toEqual(expTags);
|
||||||
|
|||||||
8
dist/index.js
generated
vendored
8
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
58
eslint.config.js
Normal file
58
eslint.config.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
const {defineConfig, globalIgnores} = require('eslint/config');
|
||||||
|
const {fixupConfigRules, fixupPluginRules} = require('@eslint/compat');
|
||||||
|
const typescriptEslint = require('@typescript-eslint/eslint-plugin');
|
||||||
|
const jestPlugin = require('eslint-plugin-jest');
|
||||||
|
const prettier = require('eslint-plugin-prettier');
|
||||||
|
const globals = require('globals');
|
||||||
|
const tsParser = require('@typescript-eslint/parser');
|
||||||
|
const js = require('@eslint/js');
|
||||||
|
const {FlatCompat} = require('@eslint/eslintrc');
|
||||||
|
|
||||||
|
// __dirname and __filename exist natively in CommonJS
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = defineConfig([
|
||||||
|
globalIgnores(['dist/**/*', 'coverage/**/*', 'node_modules/**/*']),
|
||||||
|
{
|
||||||
|
// prettier-ignore
|
||||||
|
extends: fixupConfigRules(
|
||||||
|
compat.extends(
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:@typescript-eslint/eslint-recommended',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
'plugin:jest/recommended',
|
||||||
|
'plugin:prettier/recommended'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
plugins: {
|
||||||
|
'@typescript-eslint': fixupPluginRules(typescriptEslint),
|
||||||
|
jest: fixupPluginRules(jestPlugin),
|
||||||
|
prettier: fixupPluginRules(prettier)
|
||||||
|
},
|
||||||
|
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
...globals.jest
|
||||||
|
},
|
||||||
|
parser: tsParser,
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module'
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-require-imports': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowAsImport: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import fs from 'fs';
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
import os from 'os';
|
const fs = require('fs');
|
||||||
import path from 'path';
|
const os = require('os');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-'));
|
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-'));
|
||||||
|
|
||||||
@ -9,9 +10,7 @@ process.env = Object.assign({}, process.env, {
|
|||||||
GITHUB_REPOSITORY: 'docker/metadata-action',
|
GITHUB_REPOSITORY: 'docker/metadata-action',
|
||||||
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
||||||
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
||||||
}) as {
|
});
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
30
package.json
30
package.json
@ -29,7 +29,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/github": "^6.0.1",
|
"@actions/github": "^6.0.1",
|
||||||
"@docker/actions-toolkit": "^0.68.0",
|
"@docker/actions-toolkit": "^0.72.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",
|
||||||
@ -38,20 +38,22 @@
|
|||||||
"semver": "^7.7.3"
|
"semver": "^7.7.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.19.9",
|
"@eslint/compat": "^2.0.0",
|
||||||
"@types/semver": "^7.7.1",
|
"@eslint/eslintrc": "^3.3.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
"@eslint/js": "^9.39.2",
|
||||||
"@typescript-eslint/parser": "^7.18.0",
|
"@types/node": "^20.19.27",
|
||||||
"@vercel/ncc": "^0.38.3",
|
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
||||||
"dotenv": "^16.6.1",
|
"@typescript-eslint/parser": "^8.50.0",
|
||||||
"eslint": "^8.57.1",
|
"@vercel/ncc": "^0.38.4",
|
||||||
"eslint-config-prettier": "^9.1.2",
|
"dotenv": "^17.2.3",
|
||||||
"eslint-plugin-jest": "^28.14.0",
|
"eslint": "^9.39.2",
|
||||||
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
"eslint-plugin-jest": "^29.5.0",
|
||||||
"eslint-plugin-prettier": "^5.5.4",
|
"eslint-plugin-prettier": "^5.5.4",
|
||||||
"jest": "^29.7.0",
|
"jest": "^30.2.0",
|
||||||
"prettier": "^3.6.2",
|
"prettier": "^3.7.4",
|
||||||
"ts-jest": "^29.4.1",
|
"ts-jest": "^29.4.6",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.9.2"
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,7 +376,7 @@ export class Meta {
|
|||||||
if (hp.body.length == 1 && hp.body[0].type == 'MustacheStatement') {
|
if (hp.body.length == 1 && hp.body[0].type == 'MustacheStatement') {
|
||||||
return hp.body[0]['path']['parts'].length == 1 && hp.body[0]['path']['parts'][0] == 'raw';
|
return hp.body[0]['path']['parts'].length == 1 && hp.body[0]['path']['parts'][0] == 'raw';
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user