File tree Expand file tree Collapse file tree 1 file changed +20
-7
lines changed
Expand file tree Collapse file tree 1 file changed +20
-7
lines changed Original file line number Diff line number Diff line change 11name : ci-performance
2- # SECURITY: This workflow runs performance benchmarks on PRs.
3- # To prevent malicious code execution:
4- # 1. Uses 'pull_request' trigger (read-only permissions, no secrets exposed)
5- # 2. Always uses benchmark script from BASE branch (trusted code only)
6- # 3. Tests the trusted benchmark script against both base and PR implementations
7- # This means: If a PR modifies the benchmark script, those changes won't be
8- # tested until AFTER the PR is merged (security over convenience).
92on :
103 pull_request :
114 branches :
@@ -32,11 +25,31 @@ jobs:
3225 timeout-minutes : 30
3326
3427 steps :
28+ - name : Checkout PR branch (for benchmark script)
29+ uses : actions/checkout@v4
30+ with :
31+ ref : ${{ github.event.pull_request.head.sha }}
32+ fetch-depth : 1
33+
34+ - name : Save PR benchmark script
35+ run : |
36+ mkdir -p /tmp/pr-benchmark
37+ cp -r benchmark /tmp/pr-benchmark/ || echo "No benchmark directory"
38+ cp package.json /tmp/pr-benchmark/ || true
39+
3540 - name : Checkout base branch
3641 uses : actions/checkout@v4
3742 with :
3843 ref : ${{ github.base_ref }}
3944 fetch-depth : 1
45+ clean : true
46+
47+ - name : Restore PR benchmark script
48+ run : |
49+ if [ -d "/tmp/pr-benchmark/benchmark" ]; then
50+ rm -rf benchmark
51+ cp -r /tmp/pr-benchmark/benchmark .
52+ fi
4053
4154 - name : Setup Node.js
4255 uses : actions/setup-node@v4
You can’t perform that action at this time.
0 commit comments