Skip to content

Commit

Permalink
fix: Add any_evm and base validators to PR GitHub app (#1581)
Browse files Browse the repository at this point in the history
* Adds validate-pr options to .env.example
* Adds base and any_evm validators to the GitHub app
* Fixes test-deploy-owners to not run for contributors
  • Loading branch information
ryscheng authored Jun 3, 2024
1 parent 472779e commit 981401d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-deploy-owners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
with:
credentials_json: "${{ secrets.GOOGLE_BQ_ADMIN_CREDENTIALS_JSON }}"
create_credentials_file: true
if: ${{ contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association) }}
if: ${{ contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR" ]'), github.event.pull_request.author_association) }}

- name: Run test-deploy
uses: ./.github/workflows/test-deploy
Expand All @@ -66,4 +66,4 @@ jobs:

# This check isn't for security it's mostly a convenience so this won't
# fail and muddy up the actions UI
if: ${{ contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association) }}
if: ${{ contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR" ]'), github.event.pull_request.author_association) }}
25 changes: 19 additions & 6 deletions lib/oss-artifact-validators/src/onchain/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,41 @@ export function EthereumValidator(options: EthereumOptions) {
);
}

export type OptimismOptions = Omit<
export type ArbitrumOptions = Omit<
GenericEVMNetworkValidtorOptions,
"deployerTable"
>;

export function OptimismValidator(options: OptimismOptions) {
export function ArbitrumValidator(options: ArbitrumOptions) {
return GenericEVMNetworkValidator.create(
_.merge(options, {
deployerTable: "`opensource-observer.oso.stg_optimism__deployers`",
deployerTable: "`opensource-observer.oso.stg_arbitrum__deployers`",
}),
);
}

export type ArbitrumOptions = Omit<
export type BaseOptions = Omit<
GenericEVMNetworkValidtorOptions,
"deployerTable"
>;

export function ArbitrumValidator(options: ArbitrumOptions) {
export function BaseValidator(options: BaseOptions) {
return GenericEVMNetworkValidator.create(
_.merge(options, {
deployerTable: "`opensource-observer.oso.stg_arbitrum__deployers`",
deployerTable: "`opensource-observer.oso.stg_base__deployers`",
}),
);
}

export type OptimismOptions = Omit<
GenericEVMNetworkValidtorOptions,
"deployerTable"
>;

export function OptimismValidator(options: OptimismOptions) {
return GenericEVMNetworkValidator.create(
_.merge(options, {
deployerTable: "`opensource-observer.oso.stg_optimism__deployers`",
}),
);
}
10 changes: 9 additions & 1 deletion ops/external-prs/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
# https://github.com/organizations/opensource-observer/settings/apps/oso-prs
PR_TOOLS_GITHUB_APP_ID=
# Base64 encoded private key for the GitHub App
PR_TOOLS_GITHUB_APP_PRIVATE_KEY=
PR_TOOLS_GITHUB_APP_PRIVATE_KEY=

# Repo in the form owner/repo_name
PR_TOOLS_REPO=
# RPC URLs for blockchain validations
PR_TOOLS_MAINNET_RPC_URL=
PR_TOOLS_ARBITRUM_RPC_URL=
PR_TOOLS_BASE_RPC_URL=
PR_TOOLS_OPTIMISM_RPC_URL=
38 changes: 24 additions & 14 deletions ops/external-prs/src/ossd/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import mustache from "mustache";
import {
EVMNetworkValidator,
EthereumValidator,
OptimismValidator,
ArbitrumValidator,
BaseValidator,
OptimismValidator,
} from "@opensource-observer/oss-artifact-validators";
import { GithubOutput } from "../github.js";
import { CheckConclusion, CheckStatus } from "../checks.js";
Expand Down Expand Up @@ -138,19 +139,24 @@ export function ossdSubcommands(yargs: Argv) {
description: "duckdb memory limit (needed for github actions)",
default: "",
})
.option("optimism-rpc-url", {
.option("mainnet-rpc-url", {
type: "string",
description: "Optimism RPC URL",
description: "Ethereum Mainnet RPC URL",
demandOption: true,
})
.option("arbitrum-rpc-url", {
type: "string",
description: "Ethereum Mainnet RPC URL",
demandOption: true,
})
.option("mainnet-rpc-url", {
.option("base-rpc-url", {
type: "string",
description: "Ethereum Mainnet RPC URL",
description: "Base RPC URL",
demandOption: true,
})
.option("optimism-rpc-url", {
type: "string",
description: "Optimism RPC URL",
demandOption: true,
});
},
Expand Down Expand Up @@ -184,9 +190,10 @@ interface OSSDirectoryPullRequestArgs extends BaseArgs {
}

interface RpcUrlArgs {
optimismRpcUrl: string;
mainnetRpcUrl: string;
arbitrumRpcUrl: string;
baseRpcUrl: string;
optimismRpcUrl: string;
}

type ValidatePRArgs = OSSDirectoryPullRequestArgs & RpcUrlArgs;
Expand Down Expand Up @@ -313,14 +320,9 @@ class OSSDirectoryPullRequest {
this.validators = {};
}

async loadValidators(
urls: Pick<
ValidatePRArgs,
"mainnetRpcUrl" | "optimismRpcUrl" | "arbitrumRpcUrl"
>,
) {
this.validators["optimism"] = OptimismValidator({
rpcUrl: urls.optimismRpcUrl,
async loadValidators(urls: RpcUrlArgs) {
this.validators["any_evm"] = EthereumValidator({
rpcUrl: urls.mainnetRpcUrl,
});

this.validators["mainnet"] = EthereumValidator({
Expand All @@ -330,6 +332,14 @@ class OSSDirectoryPullRequest {
this.validators["arbitrum"] = ArbitrumValidator({
rpcUrl: urls.arbitrumRpcUrl,
});

this.validators["base"] = BaseValidator({
rpcUrl: urls.baseRpcUrl,
});

this.validators["optimism"] = OptimismValidator({
rpcUrl: urls.optimismRpcUrl,
});
}

async dbAll(query: string) {
Expand Down

0 comments on commit 981401d

Please sign in to comment.