Merge pull request #48 from crazy-max/nits

fix some nits to be consistent across actions
This commit is contained in:
CrazyMax
2026-03-02 10:41:10 +01:00
committed by GitHub
5 changed files with 29 additions and 39 deletions

View File

@@ -32,7 +32,7 @@ describe('getInputs', () => {
});
// prettier-ignore
test.each([
const cases: [number, Map<string, string>, context.Inputs][] = [
[
0,
new Map<string, string>([
@@ -41,7 +41,7 @@ describe('getInputs', () => {
{
version: '',
cacheBinary: true,
} as context.Inputs
}
],
[
1,
@@ -52,18 +52,16 @@ describe('getInputs', () => {
{
version: 'v2.32.4',
cacheBinary: false
} as context.Inputs
}
]
])(
'[%d] given %p as inputs, returns %p',
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
inputs.forEach((value: string, name: string) => {
setInput(name, value);
});
const res = await context.getInputs();
expect(res).toEqual(expected);
}
);
];
test.each(cases)('[%d] given %o as inputs, returns %o', async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
inputs.forEach((value: string, name: string) => {
setInput(name, value);
});
const res = await context.getInputs();
expect(res).toEqual(expected);
});
});
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67

View File

@@ -2,7 +2,7 @@ import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-actions-toolkit-'));
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-compose-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,

View File

@@ -3,10 +3,11 @@
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git
RUN apk add --no-cache cpio findutils git rsync
WORKDIR /src
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache <<EOT
set -e
corepack enable
yarn --version
yarn config set --home enableTelemetry 0
@@ -34,18 +35,27 @@ RUN --mount=type=bind,target=.,rw <<EOT
EOT
FROM deps AS build
RUN --mount=type=bind,target=.,rw \
RUN --mount=target=/context \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run build && mkdir /out && cp -Rf dist /out/
--mount=type=cache,target=/src/node_modules <<EOT
set -e
rsync -a /context/. .
rm -rf dist
yarn run build
mkdir /out
cp -r dist /out
EOT
FROM scratch AS build-update
COPY --from=build /out /
FROM build AS build-validate
RUN --mount=type=bind,target=.,rw <<EOT
RUN --mount=target=/context \
--mount=target=.,type=tmpfs <<EOT
set -e
rsync -a /context/. .
git add -A
rm -rf dist
cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \
yarn run format \
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
FROM scratch AS format-update
COPY --from=format /out /

View File

@@ -3,7 +3,6 @@
"module": "nodenext",
"moduleResolution": "nodenext",
"esModuleInterop": true,
"strict": true,
"newLine": "lf",
"outDir": "./lib",
"rootDir": "./src",

View File

@@ -1,19 +1,3 @@
/**
* Copyright 2026 actions-toolkit authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {defineConfig} from 'vitest/config';
export default defineConfig({
@@ -26,7 +10,7 @@ export default defineConfig({
provider: 'v8',
reporter: ['clover'],
include: ['src/**/*.ts'],
exclude: ['src/**/main.ts', '__tests__/**', 'dist/**']
exclude: ['src/**/main.ts']
}
}
});