Skip to content

Commit a9569a6

Browse files
author
Peter Steinberger
committed
Merge remote-tracking branch 'origin/main' into codex/pr-117481-author-refresh
2 parents 858bcc4 + e7f1202 commit a9569a6

702 files changed

Lines changed: 22252 additions & 30147 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Prepare Testbox shell
2+
description: Pin the checked-out base ref and expose the setup-node toolchain to Testbox.
3+
4+
inputs:
5+
base-ref:
6+
description: Commit or ref that Testbox should treat as origin/main; defaults to HEAD.
7+
required: false
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Pin Testbox base and Node tools
13+
shell: bash
14+
env:
15+
TESTBOX_BASE_REF: ${{ inputs.base-ref }}
16+
run: |
17+
set -euo pipefail
18+
19+
base_ref="${TESTBOX_BASE_REF:-HEAD}"
20+
if ! base_sha="$(git rev-parse --verify "${base_ref}^{commit}")"; then
21+
echo "Testbox base commit is missing from the maintained checkout: $base_ref" >&2
22+
exit 1
23+
fi
24+
git update-ref refs/remotes/origin/main "$base_sha"
25+
26+
node_bin="$(dirname "$(node -p 'process.execPath')")"
27+
link_node_tool() {
28+
local tool="$1"
29+
local source="$node_bin/$tool"
30+
local target="/usr/local/bin/$tool"
31+
if [ -e "$target" ] && [ "$(readlink -f "$source")" = "$(readlink -f "$target")" ]; then
32+
return
33+
fi
34+
sudo ln -sf "$source" "$target"
35+
}
36+
link_node_tool node
37+
link_node_tool npm
38+
link_node_tool npx
39+
link_node_tool corepack
40+
sudo tee /usr/local/bin/pnpm >/dev/null <<'PNPM'
41+
#!/usr/bin/env bash
42+
exec /usr/local/bin/corepack pnpm "$@"
43+
PNPM
44+
sudo chmod 0755 /usr/local/bin/pnpm

‎.github/workflows/ci-build-artifacts-testbox.yml‎

Lines changed: 7 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,10 @@ jobs:
3636
testbox_id: ${{ inputs.testbox_id }}
3737

3838
- name: Checkout
39-
shell: bash
40-
env:
41-
CHECKOUT_REPO: ${{ github.repository }}
42-
CHECKOUT_SHA: ${{ github.sha }}
43-
CHECKOUT_TOKEN: ${{ github.token }}
44-
run: |
45-
set -euo pipefail
46-
47-
workdir="$GITHUB_WORKSPACE"
48-
if [[ -z "$CHECKOUT_TOKEN" ]]; then
49-
echo "checkout token is missing" >&2
50-
exit 1
51-
fi
52-
auth_header="$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 | tr -d '\n')"
53-
54-
reset_checkout_dir() {
55-
mkdir -p "$workdir"
56-
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
57-
}
58-
59-
checkout_attempt() {
60-
local attempt="$1"
61-
62-
reset_checkout_dir
63-
git init "$workdir" >/dev/null
64-
git config --global --add safe.directory "$workdir"
65-
git -C "$workdir" remote add origin "https://github.com/${CHECKOUT_REPO}"
66-
git -C "$workdir" config gc.auto 0
67-
68-
timeout --signal=TERM --kill-after=10s 120s git -C "$workdir" \
69-
-c protocol.version=2 \
70-
-c "http.extraheader=AUTHORIZATION: basic ${auth_header}" \
71-
fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \
72-
"+${CHECKOUT_SHA}:refs/remotes/origin/ci-target" || return 1
73-
74-
git -C "$workdir" checkout --force --detach "$CHECKOUT_SHA" || return 1
75-
test -f "$workdir/.github/actions/setup-node-env/action.yml" || return 1
76-
echo "checkout attempt ${attempt}/5 succeeded"
77-
}
78-
79-
for attempt in 1 2 3 4 5; do
80-
if checkout_attempt "$attempt"; then
81-
exit 0
82-
fi
83-
echo "checkout attempt ${attempt}/5 failed"
84-
sleep $((attempt * 5))
85-
done
86-
87-
echo "checkout failed after 5 attempts" >&2
88-
exit 1
39+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
40+
with:
41+
fetch-depth: ${{ github.event_name == 'pull_request' && '2' || '0' }}
42+
persist-credentials: false
8943

9044
- name: Setup Node environment
9145
uses: ./.github/actions/setup-node-env
@@ -192,34 +146,9 @@ jobs:
192146
key: ${{ runner.os }}-dist-build-v2-${{ github.sha }}
193147

194148
- name: Prepare Testbox shell
195-
shell: bash
196-
run: |
197-
set -euo pipefail
198-
199-
timeout --signal=TERM --kill-after=10s 120s git \
200-
-c protocol.version=2 \
201-
fetch --no-tags --prune --no-recurse-submodules --depth=50 origin \
202-
"+refs/heads/main:refs/remotes/origin/main"
203-
204-
node_bin="$(dirname "$(node -p 'process.execPath')")"
205-
link_node_tool() {
206-
local tool="$1"
207-
local source="$node_bin/$tool"
208-
local target="/usr/local/bin/$tool"
209-
if [ -e "$target" ] && [ "$(readlink -f "$source")" = "$(readlink -f "$target")" ]; then
210-
return
211-
fi
212-
sudo ln -sf "$source" "$target"
213-
}
214-
link_node_tool node
215-
link_node_tool npm
216-
link_node_tool npx
217-
link_node_tool corepack
218-
sudo tee /usr/local/bin/pnpm >/dev/null <<'PNPM'
219-
#!/usr/bin/env bash
220-
exec /usr/local/bin/corepack pnpm "$@"
221-
PNPM
222-
sudo chmod 0755 /usr/local/bin/pnpm
149+
uses: ./.github/actions/prepare-testbox-shell
150+
with:
151+
base-ref: ${{ github.event.pull_request.base.sha || 'refs/remotes/origin/main' }}
223152

224153
- name: Hydrate Testbox provider env helper
225154
shell: bash

‎.github/workflows/ci-check-arm-testbox.yml‎

Lines changed: 7 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -51,90 +51,19 @@ jobs:
5151
;;
5252
esac
5353
- name: Checkout
54-
shell: bash
55-
env:
56-
CHECKOUT_REPO: ${{ github.repository }}
57-
CHECKOUT_SHA: ${{ github.sha }}
58-
CHECKOUT_TOKEN: ${{ github.token }}
59-
run: |
60-
set -euo pipefail
61-
62-
workdir="$GITHUB_WORKSPACE"
63-
if [[ -z "$CHECKOUT_TOKEN" ]]; then
64-
echo "checkout token is missing" >&2
65-
exit 1
66-
fi
67-
auth_header="$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 | tr -d '\n')"
68-
69-
reset_checkout_dir() {
70-
mkdir -p "$workdir"
71-
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
72-
}
73-
74-
checkout_attempt() {
75-
local attempt="$1"
76-
77-
reset_checkout_dir
78-
git init "$workdir" >/dev/null
79-
git config --global --add safe.directory "$workdir"
80-
git -C "$workdir" remote add origin "https://github.com/${CHECKOUT_REPO}"
81-
git -C "$workdir" config gc.auto 0
82-
83-
timeout --signal=TERM --kill-after=10s 120s git -C "$workdir" \
84-
-c protocol.version=2 \
85-
-c "http.extraheader=AUTHORIZATION: basic ${auth_header}" \
86-
fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \
87-
"+${CHECKOUT_SHA}:refs/remotes/origin/ci-target" || return 1
88-
89-
git -C "$workdir" checkout --force --detach "$CHECKOUT_SHA" || return 1
90-
test -f "$workdir/.github/actions/setup-node-env/action.yml" || return 1
91-
echo "checkout attempt ${attempt}/5 succeeded"
92-
}
93-
94-
for attempt in 1 2 3 4 5; do
95-
if checkout_attempt "$attempt"; then
96-
exit 0
97-
fi
98-
echo "checkout attempt ${attempt}/5 failed"
99-
sleep $((attempt * 5))
100-
done
101-
102-
echo "checkout failed after 5 attempts" >&2
103-
exit 1
54+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
55+
with:
56+
fetch-depth: ${{ github.event_name == 'pull_request' && '2' || '0' }}
57+
persist-credentials: false
10458
- name: Setup Node environment
10559
uses: ./.github/actions/setup-node-env
10660
with:
10761
install-bun: "false"
10862
install-trufflehog: "true"
10963
- name: Prepare Testbox shell
110-
shell: bash
111-
run: |
112-
set -euo pipefail
113-
114-
timeout --signal=TERM --kill-after=10s 120s git \
115-
-c protocol.version=2 \
116-
fetch --no-tags --prune --no-recurse-submodules --depth=50 origin \
117-
"+refs/heads/main:refs/remotes/origin/main"
118-
119-
node_bin="$(dirname "$(node -p 'process.execPath')")"
120-
link_node_tool() {
121-
local tool="$1"
122-
local source="$node_bin/$tool"
123-
local target="/usr/local/bin/$tool"
124-
if [ -e "$target" ] && [ "$(readlink -f "$source")" = "$(readlink -f "$target")" ]; then
125-
return
126-
fi
127-
sudo ln -sf "$source" "$target"
128-
}
129-
link_node_tool node
130-
link_node_tool npm
131-
link_node_tool npx
132-
link_node_tool corepack
133-
sudo tee /usr/local/bin/pnpm >/dev/null <<'PNPM'
134-
#!/usr/bin/env bash
135-
exec /usr/local/bin/corepack pnpm "$@"
136-
PNPM
137-
sudo chmod 0755 /usr/local/bin/pnpm
64+
uses: ./.github/actions/prepare-testbox-shell
65+
with:
66+
base-ref: ${{ github.event.pull_request.base.sha || 'refs/remotes/origin/main' }}
13867

13968
- name: Hydrate Testbox provider env helper
14069
shell: bash

‎.github/workflows/ci-check-testbox.yml‎

Lines changed: 7 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -43,56 +43,10 @@ jobs:
4343
with:
4444
testbox_id: ${{ inputs.testbox_id }}
4545
- name: Checkout
46-
shell: bash
47-
env:
48-
CHECKOUT_REPO: ${{ github.repository }}
49-
CHECKOUT_SHA: ${{ github.sha }}
50-
CHECKOUT_TOKEN: ${{ github.token }}
51-
run: |
52-
set -euo pipefail
53-
54-
workdir="$GITHUB_WORKSPACE"
55-
if [[ -z "$CHECKOUT_TOKEN" ]]; then
56-
echo "checkout token is missing" >&2
57-
exit 1
58-
fi
59-
auth_header="$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 | tr -d '\n')"
60-
61-
reset_checkout_dir() {
62-
mkdir -p "$workdir"
63-
find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
64-
}
65-
66-
checkout_attempt() {
67-
local attempt="$1"
68-
69-
reset_checkout_dir
70-
git init "$workdir" >/dev/null
71-
git config --global --add safe.directory "$workdir"
72-
git -C "$workdir" remote add origin "https://github.com/${CHECKOUT_REPO}"
73-
git -C "$workdir" config gc.auto 0
74-
75-
timeout --signal=TERM --kill-after=10s 120s git -C "$workdir" \
76-
-c protocol.version=2 \
77-
-c "http.extraheader=AUTHORIZATION: basic ${auth_header}" \
78-
fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \
79-
"+${CHECKOUT_SHA}:refs/remotes/origin/ci-target" || return 1
80-
81-
git -C "$workdir" checkout --force --detach "$CHECKOUT_SHA" || return 1
82-
test -f "$workdir/.github/actions/setup-node-env/action.yml" || return 1
83-
echo "checkout attempt ${attempt}/5 succeeded"
84-
}
85-
86-
for attempt in 1 2 3 4 5; do
87-
if checkout_attempt "$attempt"; then
88-
exit 0
89-
fi
90-
echo "checkout attempt ${attempt}/5 failed"
91-
sleep $((attempt * 5))
92-
done
93-
94-
echo "checkout failed after 5 attempts" >&2
95-
exit 1
46+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
47+
with:
48+
fetch-depth: ${{ github.event_name == 'pull_request' && '2' || '0' }}
49+
persist-credentials: false
9650
- name: Setup Node environment
9751
uses: ./.github/actions/setup-node-env
9852
with:
@@ -103,34 +57,9 @@ jobs:
10357
sticky-disk: ${{ github.event_name == 'workflow_dispatch' && 'true' || 'false' }}
10458
use-actions-cache: ${{ github.event_name == 'workflow_dispatch' && 'false' || 'true' }}
10559
- name: Prepare Testbox shell
106-
shell: bash
107-
run: |
108-
set -euo pipefail
109-
110-
timeout --signal=TERM --kill-after=10s 120s git \
111-
-c protocol.version=2 \
112-
fetch --no-tags --prune --no-recurse-submodules --depth=50 origin \
113-
"+refs/heads/main:refs/remotes/origin/main"
114-
115-
node_bin="$(dirname "$(node -p 'process.execPath')")"
116-
link_node_tool() {
117-
local tool="$1"
118-
local source="$node_bin/$tool"
119-
local target="/usr/local/bin/$tool"
120-
if [ -e "$target" ] && [ "$(readlink -f "$source")" = "$(readlink -f "$target")" ]; then
121-
return
122-
fi
123-
sudo ln -sf "$source" "$target"
124-
}
125-
link_node_tool node
126-
link_node_tool npm
127-
link_node_tool npx
128-
link_node_tool corepack
129-
sudo tee /usr/local/bin/pnpm >/dev/null <<'PNPM'
130-
#!/usr/bin/env bash
131-
exec /usr/local/bin/corepack pnpm "$@"
132-
PNPM
133-
sudo chmod 0755 /usr/local/bin/pnpm
60+
uses: ./.github/actions/prepare-testbox-shell
61+
with:
62+
base-ref: ${{ github.event.pull_request.base.sha || 'refs/remotes/origin/main' }}
13463

13564
- name: Hydrate Testbox provider env helper
13665
shell: bash

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,11 +806,20 @@ jobs:
806806
PRE_COMMIT_HOME: .cache/pre-commit-security-fast
807807
steps:
808808
- name: Checkout
809+
if: github.event_name != 'workflow_dispatch' || inputs.target_ref == ''
810+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
811+
with:
812+
fetch-depth: 2
813+
persist-credentials: false
814+
815+
# Manual target validation has a distinct fallback contract: a missing branch/tag
816+
# falls back to the workflow SHA, while transport timeouts still fail closed.
817+
- name: Checkout manual target
818+
if: github.event_name == 'workflow_dispatch' && inputs.target_ref != ''
809819
env:
810820
CHECKOUT_REPO: ${{ github.repository }}
811-
CHECKOUT_REF: ${{ inputs.target_ref || github.sha }}
821+
CHECKOUT_REF: ${{ inputs.target_ref }}
812822
CHECKOUT_FALLBACK_REF: ${{ github.sha }}
813-
GITHUB_EVENT_NAME: ${{ github.event_name }}
814823
run: |
815824
set -euo pipefail
816825
git init "$GITHUB_WORKSPACE"
@@ -843,7 +852,7 @@ jobs:
843852
echo "::error::checkout fetch for '$CHECKOUT_REF' timed out"
844853
exit "$fetch_status"
845854
fi
846-
if [ "$GITHUB_EVENT_NAME" != "workflow_dispatch" ] || [ "$CHECKOUT_REF" = "$CHECKOUT_FALLBACK_REF" ]; then
855+
if [ "$CHECKOUT_REF" = "$CHECKOUT_FALLBACK_REF" ]; then
847856
exit "$fetch_status"
848857
fi
849858
echo "::warning::workflow_dispatch target_ref '$CHECKOUT_REF' is unavailable; falling back to head SHA '$CHECKOUT_FALLBACK_REF'"

0 commit comments

Comments
 (0)