Skip to content

Commit 02ec474

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

File tree

3 files changed

+27
-13
lines changed

3 files changed

+27
-13
lines changed

.github/workflows/validate.yml

Lines changed: 14 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_target:
3+
types: [opened, synchronize, reopened]
4+
branches:
45
- "main"
6+
- "experimental"
57

68
name: validate-compatibility
79
jobs:
@@ -10,13 +12,22 @@ jobs:
1012
runs-on: ubuntu-latest
1113
steps:
1214
- uses: actions/checkout@v2
15+
with:
16+
ref: ${{ github.event.pull_request.head.sha }}
1317
- name: install
1418
run: make install
1519
- name: buf breaking
16-
run: make buf-breaking
20+
env:
21+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
22+
run: |
23+
echo "base_ref=${{ github.event.pull_request.base.ref }}"
24+
echo "BASE_BRANCH=$BASE_BRANCH"
25+
make buf-breaking
1726
- name: buf lint
1827
run: make buf-lint
1928
- name: build and compile test
2029
run: make test
2130
- name: run the check script
31+
env:
32+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
2233
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)