Skip to content

Commit

Permalink
fix: refactor diff, release, and ci
Browse files Browse the repository at this point in the history
Remove unused regex in diff.
Refactor release ci.
Upgrade diff ci script version and refactor branch.
  • Loading branch information
robproject committed Mar 23, 2024
1 parent 8ff8df0 commit bcfb91a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: Diff Sample
on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main

jobs:
Diff:
Expand Down Expand Up @@ -37,7 +39,7 @@ jobs:
- name: Post comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ on:

jobs:
Release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
issues: write
pull-requests: write
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand Down
13 changes: 4 additions & 9 deletions frappe_schema_json_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from dataclasses import dataclass
import os
import json
import re
from typing import Optional
import sys

Expand Down Expand Up @@ -334,11 +333,6 @@ def symmetric_diff_sep(
return exclusive_set1, exclusive_set2


def print_custom(path: str) -> None:
if re.search("\/custom\/.*\.json", path):
console.log(f"[bold magenta]Custom File[/bold magenta]")


if __name__ == "__main__":

# https://github.com/azrafe7/test_python_rich_on_gh_pages/blob/0015be3b6b1925c4d4c9acbaed319666ff7cec89/main.py
Expand All @@ -352,13 +346,14 @@ def print_custom(path: str) -> None:

if old_path.rsplit(".", maxsplit=1)[-1] == "json":
if new_hex == ".":
console.log(
f"[bold][red]Removed: {old_path.split('/')[-1]}[/red][/bold]"
)
console.log(f"[bold][red]Removed: {old_path.split('/')[-1]}[/red][/bold]")
else:
if "custom" in new_path:
console.log(f"[bold][magenta]Custom File:[/magenta][/bold]")
diff = FrappeDiff(old_path, new_path, table_mode)
diff.prep()
diff.print()
console.log()

import os, psutil # Get the parent process name.
pprocName = psutil.Process(os.getppid()).name()
1 change: 0 additions & 1 deletion test_files/custom/bankacct.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"_user_tags": null,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": null,
"columns": 0,
Expand Down

0 comments on commit bcfb91a

Please sign in to comment.