Skip to content

Commit 80f7757

Browse files
Merge pull request #220 from step-security/auto-cherry-pick
chore: Cherry-picked changes from upstream
2 parents c2c8adb + 9488e1d commit 80f7757

24 files changed

Lines changed: 5144 additions & 7623 deletions

.github/workflows/actions_release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ on:
99
script:
1010
description: "Specify a script to run after audit fix"
1111
required: false
12-
default: "yarn run all"
12+
default: "yarn all"
13+
node_version:
14+
description: "Node.js version to use"
15+
required: false
16+
default: "24"
1317

1418
permissions:
1519
contents: read
@@ -24,3 +28,4 @@ jobs:
2428
with:
2529
tag: "${{ github.event.inputs.tag }}"
2630
script: "${{ github.event.inputs.script }}"
31+
node_version: ${{ github.event.inputs.node_version || '24' }}

.github/workflows/audit_package.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ on:
1414
script:
1515
description: "Specify a script to run after audit fix"
1616
required: false
17-
default: "yarn run all"
18-
17+
default: "yarn all"
18+
node_version:
19+
description: "Node.js version to use"
20+
required: false
21+
default: "24"
22+
1923
schedule:
2024
- cron: "0 0 * * 1"
2125

@@ -26,6 +30,7 @@ jobs:
2630
base_branch: ${{ inputs.base_branch || 'main' }}
2731
package_manager: "yarn"
2832
script: ${{ inputs.script || 'yarn run all' }}
33+
node_version: ${{ inputs.node_version || '24' }}
2934

3035
permissions:
3136
contents: write

.github/workflows/auto_cherry_pick.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
description: "Specify a script to run after audit fix"
1616
required: false
1717
default: "yarn run all"
18+
node_version:
19+
description: "Node.js version to use"
20+
required: false
21+
default: "24"
22+
1823
pull_request:
1924
types: [opened, synchronize, labeled]
2025

@@ -35,3 +40,5 @@ jobs:
3540
package_manager: "yarn"
3641
script: ${{ inputs.script || 'yarn run all' }}
3742
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode }}
43+
node_version: ${{ inputs.node_version || '24' }}
44+

.prettierrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"singleQuote": true,
77
"trailingComma": "none",
88
"bracketSpacing": false,
9-
"arrowParens": "avoid",
10-
"parser": "typescript"
9+
"arrowParens": "avoid"
1110
}

.yarnrc.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
# https://yarnpkg.com/configuration/yarnrc
2+
3+
compressionLevel: mixed
4+
enableGlobalCache: false
5+
enableHardenedMode: true
6+
17
logFilters:
28
- code: YN0013
39
level: discard
410
- code: YN0019
511
level: discard
612
- code: YN0076
713
level: discard
14+
- code: YN0086
15+
level: discard
816

917
nodeLinker: node-modules
10-
11-
plugins:
12-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
13-
spec: "@yarnpkg/plugin-interactive-tools"

__tests__/context.test.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {beforeEach, describe, expect, test} from '@jest/globals';
1+
import {beforeEach, describe, expect, test} from 'vitest';
22
import * as os from 'os';
33
import * as path from 'path';
44

5-
import * as context from '../src/context';
5+
import * as context from '../src/context.js';
66

77
describe('getInputs', () => {
88
beforeEach(() => {
@@ -15,7 +15,7 @@ describe('getInputs', () => {
1515
});
1616

1717
// prettier-ignore
18-
test.each([
18+
const cases: [number, Map<string, string>, context.Inputs][] = [
1919
[
2020
0,
2121
new Map<string, string>([
@@ -35,7 +35,7 @@ describe('getInputs', () => {
3535
setHost: false,
3636
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
3737
githubToken: '',
38-
} as context.Inputs
38+
}
3939
],
4040
[
4141
1,
@@ -59,7 +59,7 @@ describe('getInputs', () => {
5959
setHost: false,
6060
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
6161
githubToken: '',
62-
} as context.Inputs
62+
}
6363
],
6464
[
6565
2,
@@ -79,7 +79,7 @@ describe('getInputs', () => {
7979
setHost: true,
8080
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
8181
githubToken: '',
82-
} as context.Inputs
82+
}
8383
],
8484
[
8585
3,
@@ -101,7 +101,7 @@ describe('getInputs', () => {
101101
setHost: false,
102102
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
103103
githubToken: '',
104-
} as context.Inputs
104+
}
105105
],
106106
[
107107
4,
@@ -121,7 +121,7 @@ describe('getInputs', () => {
121121
setHost: false,
122122
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
123123
githubToken: '',
124-
} as context.Inputs
124+
}
125125
],
126126
[
127127
5,
@@ -142,7 +142,7 @@ describe('getInputs', () => {
142142
rootless: false,
143143
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
144144
githubToken: '',
145-
} as context.Inputs
145+
}
146146
],
147147
[
148148
6,
@@ -163,7 +163,7 @@ describe('getInputs', () => {
163163
rootless: false,
164164
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
165165
githubToken: '',
166-
} as context.Inputs
166+
}
167167
],
168168
[
169169
7,
@@ -183,7 +183,7 @@ describe('getInputs', () => {
183183
rootless: false,
184184
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
185185
githubToken: '',
186-
} as context.Inputs
186+
}
187187
],
188188
[
189189
8,
@@ -203,7 +203,7 @@ describe('getInputs', () => {
203203
rootless: true,
204204
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
205205
githubToken: '',
206-
} as context.Inputs
206+
}
207207
],
208208
[
209209
9,
@@ -226,10 +226,11 @@ describe('getInputs', () => {
226226
setHost: false,
227227
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
228228
githubToken: '',
229-
} as context.Inputs
229+
}
230230
],
231-
])(
232-
'[%d] given %p as inputs, returns %p',
231+
];
232+
test.each(cases)(
233+
'[%d] given %o as inputs, returns %o',
233234
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
234235
inputs.forEach((value: string, name: string) => {
235236
setInput(name, value);

__tests__/setup.unit.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import fs from 'node:fs';
2+
import os from 'node:os';
3+
import path from 'node:path';
4+
5+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-docker-action-'));
6+
7+
process.env = Object.assign({}, process.env, {
8+
TEMP: tmpDir,
9+
GITHUB_REPOSITORY: 'docker/setup-docker-action',
10+
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
11+
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
12+
});

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ outputs:
4545
description: "Docker TCP address if tcp-port is set"
4646

4747
runs:
48-
using: 'node20'
48+
using: 'node24'
4949
main: 'dist/index.js'
5050
post: 'dist/index.js'

dev.Dockerfile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# syntax=docker/dockerfile:1
22

3-
ARG NODE_VERSION=20
3+
ARG NODE_VERSION=24
44

55
FROM node:${NODE_VERSION}-alpine AS base
6-
RUN apk add --no-cache cpio findutils git
6+
RUN apk add --no-cache cpio findutils git rsync
77
WORKDIR /src
88
RUN --mount=type=bind,target=.,rw \
99
--mount=type=cache,target=/src/.yarn/cache <<EOT
10+
set -e
1011
corepack enable
1112
yarn --version
1213
yarn config set --home enableTelemetry 0
@@ -27,25 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
2728
git add -A
2829
cp -rf /vendor/* .
2930
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
30-
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
31+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
3132
git status --porcelain -- yarn.lock
3233
exit 1
3334
fi
3435
EOT
3536

3637
FROM deps AS build
37-
RUN --mount=type=bind,target=.,rw \
38+
RUN --mount=target=/context \
3839
--mount=type=cache,target=/src/.yarn/cache \
39-
--mount=type=cache,target=/src/node_modules \
40-
yarn run build && mkdir /out && cp -Rf dist /out/
40+
--mount=type=cache,target=/src/node_modules <<EOT
41+
set -e
42+
rsync -a /context/. .
43+
rm -rf dist
44+
yarn run build
45+
mkdir /out
46+
cp -r dist /out
47+
EOT
4148

4249
FROM scratch AS build-update
4350
COPY --from=build /out /
4451

4552
FROM build AS build-validate
46-
RUN --mount=type=bind,target=.,rw <<EOT
53+
RUN --mount=target=/context \
54+
--mount=target=.,type=tmpfs <<EOT
4755
set -e
56+
rsync -a /context/. .
4857
git add -A
58+
rm -rf dist
4959
cp -rf /out/* .
5060
if [ -n "$(git status --porcelain -- dist)" ]; then
5161
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
5868
RUN --mount=type=bind,target=.,rw \
5969
--mount=type=cache,target=/src/.yarn/cache \
6070
--mount=type=cache,target=/src/node_modules \
61-
yarn run format \
62-
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
71+
yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
6372

6473
FROM scratch AS format-update
6574
COPY --from=format /out /
@@ -74,7 +83,7 @@ FROM deps AS test
7483
RUN --mount=type=bind,target=.,rw \
7584
--mount=type=cache,target=/src/.yarn/cache \
7685
--mount=type=cache,target=/src/node_modules \
77-
yarn run test --coverage --coverageDirectory=/tmp/coverage
86+
yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
7887

7988
FROM scratch AS test-coverage
8089
COPY --from=test /tmp/coverage /

dist/index.js

Lines changed: 11 additions & 78 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)