Skip to content

Commit c8a97f3

Browse files
committed
fix experimental validate check
1 parent 42c035f commit c8a97f3

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

.github/workflows/validate.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
on:
2-
push:
3-
branches-ignore:
2+
pull_request:
3+
types: [opened, synchronize, reopened]
4+
branches:
45
- "main"
6+
- "experimental"
57

68
name: validate-compatibility
79
jobs:
@@ -13,10 +15,17 @@ jobs:
1315
- name: install
1416
run: make install
1517
- name: buf breaking
16-
run: make buf-breaking
18+
env:
19+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
20+
run: |
21+
echo "base_ref=${{ github.event.pull_request.base.ref }}"
22+
echo "BASE_BRANCH=$BASE_BRANCH"
23+
make buf-breaking
1724
- name: buf lint
1825
run: make buf-lint
1926
- name: build and compile test
2027
run: make test
2128
- name: run the check script
29+
env:
30+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
2231
run: ./scripts/check-proto-compabitility.sh

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buf-build: node_modules/.bin/buf
1414
./node_modules/.bin/buf build proto/
1515

1616
buf-breaking: node_modules/.bin/buf
17-
./node_modules/.bin/buf breaking proto/ --against 'https://github.com/decentraland/protocol.git#subdir=proto'
17+
./node_modules/.bin/buf breaking proto/ --against 'https://github.com/decentraland/protocol.git#branch=$(or $(BASE_BRANCH),main),subdir=proto'
1818

1919
test: buf-lint
2020
bash scripts/test.sh
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
#!/bin/bash
22
set -e -x
33

4-
# Download the main branch ref zip
5-
protocol_main_zip_url="https://github.com/decentraland/protocol/archive/refs/heads/main.zip"
6-
protocol_main_zip_local="./protocol-main.zip"
4+
# Use BASE_BRANCH environment variable or default to main
5+
BRANCH="${BASE_BRANCH:-main}"
6+
7+
# Download the reference branch zip
8+
protocol_branch_zip_url="https://github.com/decentraland/protocol/archive/refs/heads/${BRANCH}.zip"
9+
protocol_branch_zip_local="./protocol-${BRANCH}.zip"
710

811
TMP_ZIP_DIR=$(mktemp -d)
912

10-
curl -L "$protocol_main_zip_url" -o "$protocol_main_zip_local"
11-
unzip "$protocol_main_zip_local" -d "$TMP_ZIP_DIR"
12-
rm "$protocol_main_zip_local" || true
13+
curl -L "$protocol_branch_zip_url" -o "$protocol_branch_zip_local"
14+
unzip "$protocol_branch_zip_local" -d "$TMP_ZIP_DIR"
15+
rm "$protocol_branch_zip_local" || true
1316

14-
ln -s "$(pwd)/node_modules" "$TMP_ZIP_DIR/protocol-main/node_modules"
17+
ln -s "$(pwd)/node_modules" "$TMP_ZIP_DIR/protocol-${BRANCH}/node_modules"
1518

1619
# Run the `proto-compatibility-tool` and exclude the downloaded folder.
17-
echo "Checking the compatibility against $base_url"
18-
./node_modules/.bin/proto-compatibility-tool --recursive "$TMP_ZIP_DIR/protocol-main/proto" "proto"
20+
echo "Checking the compatibility against branch: ${BRANCH}"
21+
./node_modules/.bin/proto-compatibility-tool --recursive "$TMP_ZIP_DIR/protocol-${BRANCH}/proto" "proto"
1922
# ../proto-compatibility-tool/dist/bin.js --recursive "$TMP_ZIP_DIR/protocol-main" "."
2023

2124
# rm -rf "$TMP_ZIP_DIR" || true

0 commit comments

Comments
 (0)