diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a446848..6f1aaeb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,10 +1,9 @@ name: Diff Sample on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - + branches: [main] jobs: Diff: @@ -23,7 +22,7 @@ jobs: chmod +x ./frappe_schema_json_diff.py echo "GIT_EXTERNAL_DIFF=./frappe_schema_json_diff.py" >> $GITHUB_ENV echo "TABLE_MODE=1" >> $GITHUB_ENV - + - name: Diff run: | git --no-pager diff HEAD~1 HEAD > diff_output.txt @@ -35,7 +34,7 @@ jobs: pip install ansi2html cat diff_output.txt | ansi2html > diff_output.html sed -i -n '/
/,/<\/pre>/p' diff_output.html - + - name: Post comment if: github.event_name == 'pull_request' uses: actions/github-script@v6 @@ -57,8 +56,3 @@ jobs: issue_number: issue_number, body: output, }); - - - - - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6bc6ad5..f724169 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,18 +1,26 @@ - name: Release on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] - -env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + branches: [main] jobs: Release: + permissions: + contents: write + issues: write + pull-requests: write + name: release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Release - run: npx semantic-release \ No newline at end of file + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: npm + node-version: lts/* + - run: npm clean-install + - run: corepack npm audit signatures + - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/frappe_schema_json_diff.py b/frappe_schema_json_diff.py index 0d0cd4b..0b33bbf 100755 --- a/frappe_schema_json_diff.py +++ b/frappe_schema_json_diff.py @@ -219,8 +219,8 @@ def get_common_key(self, name: str, dict_list: list) -> True: "custom_perms": "role", "permissions": "role", } - if (common_key := common_keys.get(name)) is not None: - return common_key + if (key := common_keys.get(name)) is not None: + return key else: # Find common keys then return the first one with all unique values. # https://stackoverflow.com/a/13985856/14410691