From e1bcc7342c1be9cfb49636200728bcbfa3972955 Mon Sep 17 00:00:00 2001 From: Felipe Alvarado Date: Mon, 1 Apr 2024 15:32:15 +0200 Subject: [PATCH] Add missing comma and issue number --- .../create_pr_with_new_address.py | 14 ++++++++++---- .github/workflows/create_pr_with_new_address.yml | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/scripts/github_adding_addresses/create_pr_with_new_address.py b/.github/scripts/github_adding_addresses/create_pr_with_new_address.py index dfce7bbb5..ef411ac97 100644 --- a/.github/scripts/github_adding_addresses/create_pr_with_new_address.py +++ b/.github/scripts/github_adding_addresses/create_pr_with_new_address.py @@ -66,12 +66,16 @@ def create_issue_branch(repo: Repository, chain_id: int, version: str) -> str: def create_pr( - repo: Repository, branch_name: str, chain_id: int, chain_enum_name: str + repo: Repository, + branch_name: str, + chain_id: int, + chain_enum_name: str, + issue_number: int, ) -> None: try: repo.create_pull( title=f"Add new chain {chain_enum_name} {chain_id} addresses", - body=f"Automatic PR to add new address to {chain_enum_name} {chain_id} chain", + body=f"Automatic PR to add new address to {chain_enum_name} {chain_id} chain\n Closes #{issue_number}", head=branch_name, base="main", ) @@ -157,7 +161,7 @@ def upsert_explorer_client_url( if existing_entry: print(f"Entry with URL '{client_url}' already exists.") else: - new_entry = f' EthereumNetwork.{chain_enum_name}: "{client_url}"' + new_entry = f' EthereumNetwork.{chain_enum_name}: "{client_url}",' url_lines.append(new_entry) updated_content = ( @@ -284,6 +288,7 @@ def upsert_contract_address_proxy_factory( file_path = "gnosis/safe/addresses.py" file = repo.get_contents(file_path, ref=branch_name) content = file.decoded_content.decode("utf-8") + version = version.replace("+L2", "") print( f"Updating Proxy Factory address chain {chain_enum_name} address '{address}' and block_number {block_number}" @@ -362,6 +367,7 @@ def upsert_contract_address_proxy_factory( def execute_issue_changes() -> None: github_token = os.environ.get("GITHUB_TOKEN") repository_name = os.environ.get("GITHUB_REPOSITORY_NAME") + issue_number = int(os.environ.get("ISSUE_NUMBER")) issue_body_info = json.loads(os.environ.get("ISSUE_BODY_INFO")) chain_id = int(issue_body_info.get("chainId")) version = issue_body_info.get("version") @@ -438,7 +444,7 @@ def execute_issue_changes() -> None: repo, branch_name, chain_enum_name, address_proxy, tx_block, version ) - create_pr(repo, branch_name, chain_id, chain_enum_name) + create_pr(repo, branch_name, chain_id, chain_enum_name, issue_number) if __name__ == "__main__": diff --git a/.github/workflows/create_pr_with_new_address.yml b/.github/workflows/create_pr_with_new_address.yml index d37ee8a9e..13f714247 100644 --- a/.github/workflows/create_pr_with_new_address.yml +++ b/.github/workflows/create_pr_with_new_address.yml @@ -113,6 +113,7 @@ jobs: - name: Process Issue and Create PR env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} ISSUE_BODY_INFO: ${{ steps.get-issue-inputs.outputs.result }} GITHUB_REPOSITORY_NAME: 'safe-global/safe-eth-py' run: |