Skip to content

Commit d118bbc

Browse files
committed
refactor: Simplify propose-to-safe-tx job by using reusable workflow and passing necessary inputs
1 parent 05ea315 commit d118bbc

File tree

2 files changed

+89
-34
lines changed

2 files changed

+89
-34
lines changed

.github/workflows/bridge-pause-safe.yml

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -104,37 +104,14 @@ jobs:
104104
105105
propose-to-safe-tx:
106106
needs: prepare-transaction-calldata
107-
runs-on: ubuntu-latest
108-
environment: ${{ inputs.network }}
109-
steps:
110-
- name: Checkout Safe proposal repository
111-
uses: actions/checkout@v4
112-
with:
113-
repository: iExecBlockchainComputing/github-actions-workflows
114-
path: .github-actions
115-
116-
- name: Setup Node.js
117-
uses: actions/setup-node@v4
118-
with:
119-
node-version: '22'
120-
121-
- name: Install dependencies
122-
working-directory: .github-actions/propose-safe-multisig-tx
123-
run: npm ci
124-
125-
- name: Build the action
126-
working-directory: .github-actions/propose-safe-multisig-tx
127-
run: npm run build
128-
129-
- name: Propose transaction to Safe
130-
working-directory: .github-actions/propose-safe-multisig-tx
131-
env:
132-
SAFE_ADDRESS: ${{ needs.prepare-transaction-calldata.outputs.safe-address }}
133-
TRANSACTION_TO: ${{ needs.prepare-transaction-calldata.outputs.bridge-address }}
134-
TRANSACTION_VALUE: "0"
135-
TRANSACTION_DATA: ${{ needs.prepare-transaction-calldata.outputs.transaction-data }}
136-
RPC_URL: ${{ secrets.RPC_URL }}
137-
SAFE_PROPOSER_PRIVATE_KEY: ${{ secrets.SAFE_PROPOSER_PRIVATE_KEY }}
138-
SAFE_API_KEY: ${{ secrets.SAFE_API_KEY }}
139-
DRY_RUN: ${{ inputs.dry-run }}
140-
run: npm run propose
107+
uses: ./.github/workflows/propose-safe-transaction.yml
108+
secrets:
109+
rpc-url: ${{ secrets.RPC_URL }}
110+
safe-proposer-private-key: ${{ secrets.SAFE_PROPOSER_PRIVATE_KEY }}
111+
safe-api-key: ${{ secrets.SAFE_API_KEY }}
112+
with:
113+
network: ${{ inputs.network }}
114+
safe-address: ${{ needs.prepare-transaction-calldata.outputs.safe-address }}
115+
transaction-to: ${{ needs.prepare-transaction-calldata.outputs.bridge-address }}
116+
transaction-data: ${{ needs.prepare-transaction-calldata.outputs.transaction-data }}
117+
dry-run: ${{ inputs.dry-run }}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Propose Safe Transaction (Reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
network:
7+
description: 'Network environment'
8+
required: true
9+
type: string
10+
safe-address:
11+
description: 'Safe multisig address'
12+
required: true
13+
type: string
14+
transaction-to:
15+
description: 'Transaction target address'
16+
required: true
17+
type: string
18+
transaction-data:
19+
description: 'Transaction calldata'
20+
required: true
21+
type: string
22+
transaction-value:
23+
description: 'Transaction value in wei'
24+
required: false
25+
type: string
26+
default: "0"
27+
dry-run:
28+
description: 'Dry run mode'
29+
required: false
30+
type: boolean
31+
default: true
32+
secrets:
33+
rpc-url:
34+
description: 'RPC URL for the network'
35+
required: true
36+
safe-proposer-private-key:
37+
description: 'Private key of the Safe proposer'
38+
required: true
39+
safe-api-key:
40+
description: 'Safe API key'
41+
required: true
42+
43+
jobs:
44+
propose-transaction:
45+
runs-on: ubuntu-latest
46+
environment: ${{ inputs.network }}
47+
steps:
48+
- name: Checkout Safe proposal repository
49+
uses: actions/checkout@v4
50+
with:
51+
repository: iExecBlockchainComputing/github-actions-workflows
52+
path: .github-actions
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: '22'
58+
59+
- name: Install dependencies
60+
working-directory: .github-actions/propose-safe-multisig-tx
61+
run: npm ci
62+
63+
- name: Build the action
64+
working-directory: .github-actions/propose-safe-multisig-tx
65+
run: npm run build
66+
67+
- name: Propose transaction to Safe
68+
working-directory: .github-actions/propose-safe-multisig-tx
69+
env:
70+
SAFE_ADDRESS: ${{ inputs.safe-address }}
71+
TRANSACTION_TO: ${{ inputs.transaction-to }}
72+
TRANSACTION_VALUE: ${{ inputs.transaction-value }}
73+
TRANSACTION_DATA: ${{ inputs.transaction-data }}
74+
RPC_URL: ${{ secrets.rpc-url }}
75+
SAFE_PROPOSER_PRIVATE_KEY: ${{ secrets.safe-proposer-private-key }}
76+
SAFE_API_KEY: ${{ secrets.safe-api-key }}
77+
DRY_RUN: ${{ inputs.dry-run }}
78+
run: npm run propose

0 commit comments

Comments
 (0)