Skip to content

Commit 6702b5d

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

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

.github/workflows/validate.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ jobs:
1313
- name: install
1414
run: make install
1515
- name: buf breaking
16-
run: make buf-breaking
16+
env:
17+
BASE_BRANCH: ${{ github.base_ref || 'main' }}
18+
run: |
19+
echo "github.base_ref=${{ github.base_ref }}"
20+
echo "BASE_BRANCH=$BASE_BRANCH"
21+
make buf-breaking
1722
- name: buf lint
1823
run: make buf-lint
1924
- name: build and compile test
2025
run: make test
2126
- name: run the check script
27+
env:
28+
BASE_BRANCH: ${{ github.base_ref || 'main' }}
2229
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)