Skip to content

Commit

Permalink
Add missing comma and issue number
Browse files Browse the repository at this point in the history
  • Loading branch information
falvaradorodriguez committed Apr 1, 2024
1 parent b0ef4b9 commit e1bcc73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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__":
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/create_pr_with_new_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down

0 comments on commit e1bcc73

Please sign in to comment.