Skip to content

Commit e21ec24

Browse files
authored
Merge pull request #256 from genlayerlabs/chore/nod-189-ci-automate-changelog
fix(workflows): Fix Python script execution in sync-docs-from-node workflow
2 parents 80c647d + 7103934 commit e21ec24

3 files changed

Lines changed: 47 additions & 60 deletions

File tree

‎.claude/prs/docs-node-v0.3.4.md‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎.github/scripts/sanitize-config.py‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Sanitize GenLayer node configuration by removing dev and admin sections.
4+
5+
This script is used by the GitHub Actions workflow to prepare the config
6+
for documentation by removing sensitive sections.
7+
"""
8+
9+
import sys
10+
import yaml
11+
12+
13+
def sanitize_config(config_file_path):
14+
"""Remove node.dev and node.admin sections from config file."""
15+
# Read the YAML file
16+
with open(config_file_path, 'r') as f:
17+
config = yaml.safe_load(f)
18+
19+
# Remove node.dev and node.admin if they exist
20+
if 'node' in config:
21+
if 'dev' in config['node']:
22+
del config['node']['dev']
23+
if 'admin' in config['node']:
24+
del config['node']['admin']
25+
26+
# Write back to file preserving the structure
27+
with open(config_file_path, 'w') as f:
28+
yaml.dump(config, f, default_flow_style=False, sort_keys=False, allow_unicode=True)
29+
30+
31+
def main():
32+
if len(sys.argv) != 2:
33+
print(f"Usage: {sys.argv[0]} <config_file_path>", file=sys.stderr)
34+
sys.exit(1)
35+
36+
config_file_path = sys.argv[1]
37+
38+
try:
39+
sanitize_config(config_file_path)
40+
except Exception as e:
41+
print(f"Error sanitizing config: {e}", file=sys.stderr)
42+
sys.exit(1)
43+
44+
45+
if __name__ == "__main__":
46+
main()

‎.github/workflows/sync-docs-from-node.yml‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -205,27 +205,7 @@ jobs:
205205
sed -i 's|zksyncwebsocketurl: *"[^"]*"|zksyncwebsocketurl: "TODO: Set your GenLayer Chain ZKSync WebSocket RPC URL here"|' "$TEMP_CONFIG"
206206
207207
# Remove node.dev and node.admin sections using Python for reliable YAML parsing
208-
python3 -c "
209-
import yaml
210-
import sys
211-
212-
config_file = sys.argv[1]
213-
214-
# Read the YAML file
215-
with open(config_file, 'r') as f:
216-
config = yaml.safe_load(f)
217-
218-
# Remove node.dev and node.admin if they exist
219-
if 'node' in config:
220-
if 'dev' in config['node']:
221-
del config['node']['dev']
222-
if 'admin' in config['node']:
223-
del config['node']['admin']
224-
225-
# Write back to file preserving the structure
226-
with open(config_file, 'w') as f:
227-
yaml.dump(config, f, default_flow_style=False, sort_keys=False, allow_unicode=True)
228-
" "$TEMP_CONFIG"
208+
python3 .github/scripts/sanitize-config.py "$TEMP_CONFIG"
229209
230210
# Check if the config has changed
231211
if [ -f "$DEST_CONFIG" ]; then

0 commit comments

Comments
 (0)