diff --git a/.changeset/real-pears-study.md b/.changeset/real-pears-study.md new file mode 100644 index 000000000..47d20c0be --- /dev/null +++ b/.changeset/real-pears-study.md @@ -0,0 +1,5 @@ +--- +"validate-protos-version": major +--- + +initial release diff --git a/actions/validate-protos-version/README.md b/actions/validate-protos-version/README.md new file mode 100644 index 000000000..9d58343a4 --- /dev/null +++ b/actions/validate-protos-version/README.md @@ -0,0 +1,3 @@ +# validate-protos-version + +> diff --git a/actions/validate-protos-version/action.yml b/actions/validate-protos-version/action.yml new file mode 100644 index 000000000..361e6cfa4 --- /dev/null +++ b/actions/validate-protos-version/action.yml @@ -0,0 +1,58 @@ +name: validate-protos-version +description: > + Validates that all github.com/smartcontractkit/chainlink-protos/cre/go + pseudo-versions in go.mod files reference commits from the + capabilities-development branch of chainlink-protos. + +runs: + using: composite + steps: + - name: Checkout chainlink-protos + uses: actions/checkout@v6 + with: + repository: smartcontractkit/chainlink-protos + ref: capabilities-development + path: .chainlink-protos + fetch-depth: 0 + persist-credentials: false + + - name: + Validate chainlink-protos/cre/go versions are from + capabilities-development + shell: bash + run: | + failed=0 + found=0 + + while IFS= read -r gomod; do + version=$(grep 'github.com/smartcontractkit/chainlink-protos/cre/go ' "$gomod" | head -1 | awk '{print $2}' || true) + if [[ -z "$version" ]]; then + continue + fi + + found=1 + commit=${version##*-} + + echo "Checking $gomod: version=$version commit=$commit" + + if ! git -C .chainlink-protos merge-base --is-ancestor "$commit" capabilities-development 2>/dev/null; then + echo "::error file=$gomod::commit $commit is NOT on the capabilities-development branch of chainlink-protos" + failed=1 + else + echo "OK: commit $commit is on capabilities-development" + fi + done < <(find . -name go.mod -not -path './proto_vendor/*' -not -path './.chainlink-protos/*') + + if [[ "$found" -eq 0 ]]; then + echo "::error::No go.mod files found containing chainlink-protos/cre/go" + exit 1 + fi + + if [[ "$failed" -eq 1 ]]; then + echo "" + echo "One or more go.mod files reference a chainlink-protos/cre/go commit that is not on the capabilities-development branch." + exit 1 + fi + + echo "" + echo "All chainlink-protos/cre/go versions are from capabilities-development." diff --git a/actions/validate-protos-version/package.json b/actions/validate-protos-version/package.json new file mode 100644 index 000000000..a9de587a1 --- /dev/null +++ b/actions/validate-protos-version/package.json @@ -0,0 +1,11 @@ +{ + "name": "validate-protos-version", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": {}, + "author": "@smartcontractkit", + "license": "MIT", + "dependencies": {}, + "repository": "https://github.com/smartcontractkit/.github" +} diff --git a/actions/validate-protos-version/project.json b/actions/validate-protos-version/project.json new file mode 100644 index 000000000..5e16d4d8b --- /dev/null +++ b/actions/validate-protos-version/project.json @@ -0,0 +1,8 @@ +{ + "name": "validate-protos-version", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "projectType": "application", + "sourceRoot": "actions/validate-protos-version", + "// targets": "to see all targets run: nx show project validate-protos-version --web", + "targets": {} +}