Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e0d19e

Browse filesBrowse files
marco-ippolitoMoLow
authored andcommitted
tools: automate v8 patch update
PR-URL: #47594 Refs: nodejs/security-wg#828 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 19b0f24 commit 4e0d19e
Copy full SHA for 4e0d19e

File tree

Expand file treeCollapse file tree

2 files changed

+81
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+81
-0
lines changed
Open diff view settings
Collapse file

‎.github/workflows/update-v8.yml‎

Copy file name to clipboard
+51Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: V8 patch update
2+
on:
3+
schedule:
4+
# Run once a week at 00:05 AM UTC on Sunday.
5+
- cron: 5 0 * * 0
6+
workflow_dispatch:
7+
8+
env:
9+
NODE_VERSION: lts/*
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
v8-update:
16+
if: github.repository == 'nodejs/node'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
20+
with:
21+
persist-credentials: false
22+
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
23+
with:
24+
path: |
25+
~/.update-v8
26+
~/.npm
27+
# Install dependencies
28+
- name: Install Node.js
29+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
30+
with:
31+
node-version: ${{ env.NODE_VERSION }}
32+
- name: Install node-core-utils
33+
run: npm install -g node-core-utils@latest
34+
- name: Check and download new V8 version
35+
run: |
36+
./tools/dep_updaters/update-v8-patch.sh > temp-output
37+
cat temp-output
38+
tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
39+
rm temp-output
40+
- uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5
41+
# Creates a PR or update the Action's existing PR, or
42+
# no-op if the base branch is already up-to-date.
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
45+
with:
46+
author: Node.js GitHub Bot <github-bot@iojs.org>
47+
body: This is an automated patch update of V8 to ${{ env.NEW_VERSION }}.
48+
branch: actions/update-v8-patch # Custom branch *just* for this Action.
49+
labels: v8 engine
50+
title: 'deps: patch V8 to ${{ env.NEW_VERSION }}'
51+
update-pull-request-title-and-body: true
Collapse file
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
set -e
3+
# Shell script to update v8 patch update
4+
5+
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
6+
7+
cd "$BASE_DIR"
8+
9+
IS_UP_TO_DATE=$(git node v8 minor | grep "V8 is up-to-date")
10+
11+
if [ -n "$IS_UP_TO_DATE" ]; then
12+
echo "Skipped because V8 is on the latest version."
13+
exit 0
14+
fi
15+
16+
DEPS_DIR="$BASE_DIR/deps"
17+
18+
CURRENT_MAJOR_VERSION=$(grep "#define V8_MAJOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
19+
CURRENT_MINOR_VERSION=$(grep "#define V8_MINOR_VERSION" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
20+
CURRENT_BUILD_VERSION=$(grep "#define V8_BUILD_NUMBER" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
21+
CURRENT_PATCH_VERSION=$(grep "#define V8_PATCH_LEVEL" "$DEPS_DIR/v8/include/v8-version.h" | cut -d ' ' -f3)
22+
23+
NEW_VERSION="$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION.$CURRENT_BUILD_VERSION.$CURRENT_PATCH_VERSION"
24+
25+
echo "All done!"
26+
echo ""
27+
28+
# The last line of the script should always print the new version,
29+
# as we need to add it to $GITHUB_ENV variable.
30+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.