From aac15071587d9841fc5b32fb45800e1a2076146d Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 10:05:30 -0800 Subject: [PATCH 01/25] Fix git username --- .github/workflows/i18n-custom-nodes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 03666452c..0c5faf2b7 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -116,6 +116,8 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Commit and push changes run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' git checkout -b update-locales git add -A git commit -m "Update locales" From 249f03b766a587ecfa764469153a9e16e6be18e9 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 10:20:33 -0800 Subject: [PATCH 02/25] Auth with GH token --- .github/workflows/i18n-custom-nodes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 0c5faf2b7..3f89fcf53 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -121,7 +121,7 @@ jobs: git checkout -b update-locales git add -A git commit -m "Update locales" - git remote add org_fork git@github.com:${{ inputs.fork_owner }}/${{ inputs.repository }}.git + git remote add org_fork https://${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git git push org_fork update-locales gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} From 1b287d8e1b7d810d787def59801f5ec629a4d5a8 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 10:27:05 -0800 Subject: [PATCH 03/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 3f89fcf53..4aa6f6177 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -121,7 +121,7 @@ jobs: git checkout -b update-locales git add -A git commit -m "Update locales" - git remote add org_fork https://${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git + git remote add org_fork https://${{ inputs.fork_owner }}:${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git git push org_fork update-locales gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} From 652ae375e0bf5ccc897b9e52f667defa13d88e27 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 10:46:09 -0800 Subject: [PATCH 04/25] Use gh repo sync --- .github/workflows/i18n-custom-nodes.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 4aa6f6177..2fc6a1b5f 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -121,8 +121,7 @@ jobs: git checkout -b update-locales git add -A git commit -m "Update locales" - git remote add org_fork https://${{ inputs.fork_owner }}:${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git - git push org_fork update-locales + gh repo sync ${{ inputs.fork_owner }}/${{ inputs.repository }} -b update-locales gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} env: From e1a9a9f6c90eea1f4a4fdd01282c4d9c4f5d07e2 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 10:58:46 -0800 Subject: [PATCH 05/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 2fc6a1b5f..38b8358bb 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -118,10 +118,22 @@ jobs: run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' + + # Configure the remote with token + git remote set-url origin "https://${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + + # Create and switch to new branch git checkout -b update-locales + + # Stage and commit changes git add -A git commit -m "Update locales" - gh repo sync ${{ inputs.fork_owner }}/${{ inputs.repository }} -b update-locales + + # Force push to create the branch + echo "Pushing changes to ${{ inputs.fork_owner }}/${{ inputs.repository }}" + git push -f origin update-locales + + # Create PR using gh cli gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} env: From ced85662d6fdaa814b975d4c4b2e70e012662ac1 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 11:17:35 -0800 Subject: [PATCH 06/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 38b8358bb..3fedde3e3 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -120,7 +120,7 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote set-url origin "https://${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + git remote set-url origin "https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" # Create and switch to new branch git checkout -b update-locales From d1b8996b41863782fd565e0021399cc4ba92467e Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 11:27:33 -0800 Subject: [PATCH 07/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 3fedde3e3..3536f42ef 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -107,11 +107,21 @@ jobs: cp -rf ComfyUI_frontend/temp/diff/* "$LOCALE_DIR" - name: Check and create fork of custom node repository run: | + # Try to fork the repository gh repo fork ${{ inputs.owner }}/${{ inputs.repository }} --clone=false || { echo "Fork failed - repository might already be forked" # Exit 0 to prevent the workflow from failing exit 0 } + + # Enable workflows on the forked repository + gh api \ + --method PUT \ + -H "Accept: application/vnd.github+json" \ + "/repos/${{ inputs.fork_owner }}/${{ inputs.repository }}/actions/permissions/workflow" \ + -f can_approve_pull_request_reviews=true \ + -f default_workflow_permissions="write" \ + -f enabled=true env: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Commit and push changes From 8303d664620c6a744844dde548198aeb2198a542 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 11:41:04 -0800 Subject: [PATCH 08/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 3536f42ef..dcef2aaaf 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -121,7 +121,8 @@ jobs: "/repos/${{ inputs.fork_owner }}/${{ inputs.repository }}/actions/permissions/workflow" \ -f can_approve_pull_request_reviews=true \ -f default_workflow_permissions="write" \ - -f enabled=true + -f enabled=true \ + --input-format json env: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Commit and push changes From 57b0c7bde99769d54bfda0b3739d978eafb17324 Mon Sep 17 00:00:00 2001 From: huchenlei Date: Thu, 19 Dec 2024 11:47:20 -0800 Subject: [PATCH 09/25] nit --- .github/workflows/i18n-custom-nodes.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index dcef2aaaf..e34cd1a02 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -119,10 +119,9 @@ jobs: --method PUT \ -H "Accept: application/vnd.github+json" \ "/repos/${{ inputs.fork_owner }}/${{ inputs.repository }}/actions/permissions/workflow" \ - -f can_approve_pull_request_reviews=true \ - -f default_workflow_permissions="write" \ - -f enabled=true \ - --input-format json + -F can_approve_pull_request_reviews=true \ + -F default_workflow_permissions="write" \ + -F enabled=true env: GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Commit and push changes From 2649702443d685a3fef5e863d9404bf9f42a1d46 Mon Sep 17 00:00:00 2001 From: snomiao Date: Fri, 20 Dec 2024 02:39:31 +0000 Subject: [PATCH 10/25] gh_token_pr --- .github/workflows/i18n-custom-nodes.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index e34cd1a02..3c0ab88cf 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -130,7 +130,7 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote set-url origin "https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + git remote set-url origin "https://x-access-token:${{ secrets.GH_TOKEN_PR }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" # Create and switch to new branch git checkout -b update-locales @@ -147,4 +147,4 @@ jobs: gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ secrets.GH_TOKEN_PR }} From 8a408553921893efd2c9ddabb0c2a6633005003a Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 18:30:45 +0000 Subject: [PATCH 11/25] chore(i18n): use gh-token-pr env use gh-token-pr env --- .github/workflows/i18n-custom-nodes.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 3c0ab88cf..709d88b0e 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -130,7 +130,7 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote set-url origin "https://x-access-token:${{ secrets.GH_TOKEN_PR }}@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + git remote set-url origin "https://x-access-token:$GH_TOKEN_PR@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" # Create and switch to new branch git checkout -b update-locales @@ -147,4 +147,4 @@ jobs: gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} env: - GH_TOKEN: ${{ secrets.GH_TOKEN_PR }} + GH_TOKEN_PR: ${{ secrets.GH_TOKEN_PR }} From 995be59d4863743abed96f274033a72be7da2b88 Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 18:46:40 +0000 Subject: [PATCH 12/25] chore(fix_custom_translations): i18n pr origin i18n pr origin --- .github/workflows/i18n-custom-nodes-test.yaml | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/i18n-custom-nodes-test.yaml diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml new file mode 100644 index 000000000..5c67ad86a --- /dev/null +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -0,0 +1,153 @@ +name: Update Locales for given custom node repository +on: + push: + workflow_dispatch: + inputs: + owner: + description: 'Owner of the repository to update locales for' + required: true + type: string + default: 'huchenlei' + repository: + description: 'Repository to update locales for' + required: true + type: string + default: 'ComfyUI-IC-Light-Native' + fork_owner: + description: 'Owner of the forked repository' + required: false + type: string + default: 'comfy-pr-bot' + +jobs: + update-locales: + runs-on: ubuntu-latest + steps: + - name: Checkout ComfyUI + uses: actions/checkout@v4 + with: + repository: 'comfyanonymous/ComfyUI' + path: 'ComfyUI' + ref: master + - name: Checkout ComfyUI_frontend + uses: actions/checkout@v4 + with: + repository: 'Comfy-Org/ComfyUI_frontend' + path: 'ComfyUI_frontend' + - name: Checkout ComfyUI_devtools + uses: actions/checkout@v4 + with: + repository: 'Comfy-Org/ComfyUI_devtools' + path: 'ComfyUI/custom_nodes/ComfyUI_devtools' + - name: Checkout custom node repository + uses: actions/checkout@v4 + with: + repository: ${{ inputs.owner }}/${{ inputs.repository }} + path: 'ComfyUI/custom_nodes/${{ inputs.repository }}' + - uses: actions/setup-node@v3 + with: + node-version: lts/* + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install ComfyUI requirements + run: | + python -m pip install --upgrade pip + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu + pip install -r requirements.txt + pip install wait-for-it + shell: bash + working-directory: ComfyUI + - name: Install custom node requirements + run: | + if [ -f "requirements.txt" ]; then + pip install -r requirements.txt + fi + shell: bash + working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + - name: Build & Install ComfyUI_frontend + run: | + npm ci + npm run build + rm -rf ../ComfyUI/web/* + mv dist/* ../ComfyUI/web/ + shell: bash + working-directory: ComfyUI_frontend + - name: Start ComfyUI server + run: | + python main.py --cpu --multi-user & + wait-for-it --service 127.0.0.1:8188 -t 600 + working-directory: ComfyUI + shell: bash + - name: Install Playwright Browsers + run: npx playwright install chromium --with-deps + working-directory: ComfyUI_frontend + - name: Start dev server + # Run electron dev server as it is a superset of the web dev server + # We do want electron specific UIs to be translated. + run: npm run dev:electron & + working-directory: ComfyUI_frontend + - name: Capture base i18n + run: npx tsx scripts/diff-i18n capture + working-directory: ComfyUI_frontend + - name: Update en.json + run: npm run collect-i18n + env: + PLAYWRIGHT_TEST_URL: http://localhost:5173 + working-directory: ComfyUI_frontend + - name: Update translations + run: npm run locale + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + working-directory: ComfyUI_frontend + - name: Diff base vs updated i18n + run: npx tsx scripts/diff-i18n diff + working-directory: ComfyUI_frontend + - name: Update i18n in custom node repository + run: | + LOCALE_DIR=ComfyUI/custom_nodes/${{ inputs.repository }}/locales/ + install -d "$LOCALE_DIR" + cp -rf ComfyUI_frontend/temp/diff/* "$LOCALE_DIR" + - name: Check and create fork of custom node repository + run: | + # Try to fork the repository + gh repo fork ${{ inputs.owner }}/${{ inputs.repository }} --clone=false || { + echo "Fork failed - repository might already be forked" + # Exit 0 to prevent the workflow from failing + exit 0 + } + + # Enable workflows on the forked repository + gh api \ + --method PUT \ + -H "Accept: application/vnd.github+json" \ + "/repos/${{ inputs.fork_owner }}/${{ inputs.repository }}/actions/permissions/workflow" \ + -F can_approve_pull_request_reviews=true \ + -F default_workflow_permissions="write" \ + -F enabled=true + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Commit and push changes + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + + # Configure the remote with token + git remote set-url pr "https://$GH_TOKEN_PR@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + + # Create and switch to new branch + git checkout -b update-locales + + # Stage and commit changes + git add -A + git commit -m "Update locales" + + # Force push to create the branch + echo "Pushing changes to ${{ inputs.fork_owner }}/${{ inputs.repository }}" + git push -f pr update-locales + + # Create PR using gh cli + gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales + working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + env: + GH_TOKEN_PR: ${{ secrets.GH_TOKEN_PR }} From 8db23f117f2d42121ee26ecf77322f6615c2c9ca Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 18:52:45 +0000 Subject: [PATCH 13/25] chore(workflows): try remove x-access-token try remove x-access-token --- .github/workflows/i18n-custom-nodes-test.yaml | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 5c67ad86a..de04fe83c 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -1,23 +1,25 @@ name: Update Locales for given custom node repository +env: + owner: huchenlei + repository: ComfyUI-IC-Light-Native + fork_owner: comfy-pr-bot on: push: workflow_dispatch: inputs: - owner: + owner: huchenlei description: 'Owner of the repository to update locales for' required: true type: string - default: 'huchenlei' - repository: + repository: ComfyUI-IC-Light-Native description: 'Repository to update locales for' required: true type: string - default: 'ComfyUI-IC-Light-Native' - fork_owner: + fork_owner: comfy-pr-bot description: 'Owner of the forked repository' required: false type: string - default: 'comfy-pr-bot' + default: 'Comfy-Org' jobs: update-locales: @@ -42,8 +44,8 @@ jobs: - name: Checkout custom node repository uses: actions/checkout@v4 with: - repository: ${{ inputs.owner }}/${{ inputs.repository }} - path: 'ComfyUI/custom_nodes/${{ inputs.repository }}' + repository: ${{ env.owner }}/${{ env.repository }} + path: 'ComfyUI/custom_nodes/${{ env.repository }}' - uses: actions/setup-node@v3 with: node-version: lts/* @@ -64,7 +66,7 @@ jobs: pip install -r requirements.txt fi shell: bash - working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + working-directory: ComfyUI/custom_nodes/${{ env.repository }} - name: Build & Install ComfyUI_frontend run: | npm ci @@ -105,13 +107,13 @@ jobs: working-directory: ComfyUI_frontend - name: Update i18n in custom node repository run: | - LOCALE_DIR=ComfyUI/custom_nodes/${{ inputs.repository }}/locales/ + LOCALE_DIR=ComfyUI/custom_nodes/${{ env.repository }}/locales/ install -d "$LOCALE_DIR" cp -rf ComfyUI_frontend/temp/diff/* "$LOCALE_DIR" - name: Check and create fork of custom node repository run: | # Try to fork the repository - gh repo fork ${{ inputs.owner }}/${{ inputs.repository }} --clone=false || { + gh repo fork ${{ env.owner }}/${{ env.repository }} --clone=false || { echo "Fork failed - repository might already be forked" # Exit 0 to prevent the workflow from failing exit 0 @@ -121,7 +123,7 @@ jobs: gh api \ --method PUT \ -H "Accept: application/vnd.github+json" \ - "/repos/${{ inputs.fork_owner }}/${{ inputs.repository }}/actions/permissions/workflow" \ + "/repos/${{ env.fork_owner }}/${{ env.repository }}/actions/permissions/workflow" \ -F can_approve_pull_request_reviews=true \ -F default_workflow_permissions="write" \ -F enabled=true @@ -133,7 +135,7 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote set-url pr "https://$GH_TOKEN_PR@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" + git remote set-url pr "https://${{ secrets.GH_TOKEN_PR }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" # Create and switch to new branch git checkout -b update-locales @@ -143,11 +145,11 @@ jobs: git commit -m "Update locales" # Force push to create the branch - echo "Pushing changes to ${{ inputs.fork_owner }}/${{ inputs.repository }}" + echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" git push -f pr update-locales # Create PR using gh cli - gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales - working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales + working-directory: ComfyUI/custom_nodes/${{ env.repository }} env: GH_TOKEN_PR: ${{ secrets.GH_TOKEN_PR }} From d9f6569e4bb1a250e6ee1fc23788bf0b6352c3d1 Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 19:05:03 +0000 Subject: [PATCH 14/25] chore(workflows): fix workflow fix workflow --- .github/workflows/i18n-custom-nodes-test.yaml | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index de04fe83c..3e3d431ef 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -1,25 +1,12 @@ name: Update Locales for given custom node repository + +on: + push: + env: owner: huchenlei repository: ComfyUI-IC-Light-Native fork_owner: comfy-pr-bot -on: - push: - workflow_dispatch: - inputs: - owner: huchenlei - description: 'Owner of the repository to update locales for' - required: true - type: string - repository: ComfyUI-IC-Light-Native - description: 'Repository to update locales for' - required: true - type: string - fork_owner: comfy-pr-bot - description: 'Owner of the forked repository' - required: false - type: string - default: 'Comfy-Org' jobs: update-locales: @@ -135,7 +122,7 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote set-url pr "https://${{ secrets.GH_TOKEN_PR }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" + git remote add pr "https://$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" # Create and switch to new branch git checkout -b update-locales From af7e6d73241854bb1329cfac3e649b9a713fa6eb Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 19:38:54 +0000 Subject: [PATCH 15/25] chore(workflow): try push directly to url try push directly to url --- .github/workflows/i18n-custom-nodes-test.yaml | 6 ++++-- tmp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) create mode 160000 tmp diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 3e3d431ef..2f6ec1728 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -122,7 +122,8 @@ jobs: git config --global user.email 'github-actions@github.com' # Configure the remote with token - git remote add pr "https://$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" + git remote add pr "https://x-access-token:$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" + git remote -v # Create and switch to new branch git checkout -b update-locales @@ -133,7 +134,8 @@ jobs: # Force push to create the branch echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - git push -f pr update-locales + git push -f pr update-locales || + git push -f https://x-access-token:$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales # Create PR using gh cli gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales diff --git a/tmp b/tmp new file mode 160000 index 000000000..cdc61bc84 --- /dev/null +++ b/tmp @@ -0,0 +1 @@ +Subproject commit cdc61bc84445a5c48144e33907eabf96bdf2dd52 From fc3dfe75fdf58d0c27f444f0bdcf010f7870c6d8 Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 20:16:37 +0000 Subject: [PATCH 16/25] fix(fix_custom_translations): permissions permissions --- .github/workflows/i18n-custom-nodes-test.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 2f6ec1728..07c1fdd04 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -11,6 +11,10 @@ env: jobs: update-locales: runs-on: ubuntu-latest + permissions: + contents: write # To push a branch + pull-requests: write # To create a PR from that branch + # - [git - Permission denied to github-actions[bot] despite having PAT - Stack Overflow]( https://stackoverflow.com/questions/74740868/permission-denied-to-github-actionsbot-despite-having-pat ) steps: - name: Checkout ComfyUI uses: actions/checkout@v4 From 442681121ef9ee6ee042328d02bd16feceaaec13 Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 20:47:57 +0000 Subject: [PATCH 17/25] fix(fix_custom_translations): pat prefix pat prefix --- .github/workflows/i18n-custom-nodes-test.yaml | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 07c1fdd04..8b5151a1f 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -120,29 +120,40 @@ jobs: -F enabled=true env: GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Commit and push changes + - name: Commit changes + working-directory: ComfyUI/custom_nodes/${{ env.repository }} run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - # Configure the remote with token - git remote add pr "https://x-access-token:$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git" - git remote -v - # Create and switch to new branch git checkout -b update-locales # Stage and commit changes git add -A git commit -m "Update locales" - + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app_id: ${{ vars.PR_APP_ID }} + private_key: ${{ secrets.PR_CLIENT_SECRET }} + repositories: ${{ env.fork_owner }}/${{ env.repository }} + # - uses: actions/checkout@v4 + # with: + # token: ${{ steps.app-token.outputs.token }} + - name: Push changes + working-directory: ComfyUI/custom_nodes/${{ env.repository }} + run: | # Force push to create the branch echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - git push -f pr update-locales || - git push -f https://x-access-token:$GH_TOKEN_PR@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - + git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales || \ + git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + env: + PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} + - name: Create PR + working-directory: ComfyUI/custom_nodes/${{ env.repository }} + run: | # Create PR using gh cli gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales - working-directory: ComfyUI/custom_nodes/${{ env.repository }} env: - GH_TOKEN_PR: ${{ secrets.GH_TOKEN_PR }} + GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} \ No newline at end of file From 42b66ef867ae38c5028d9c8f5f24a061bbdc5946 Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 21:09:18 +0000 Subject: [PATCH 18/25] fix(fix_custom_translations): only rename pr only rename pr --- .github/workflows/i18n-custom-nodes-test.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 8b5151a1f..26557af11 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -132,12 +132,12 @@ jobs: # Stage and commit changes git add -A git commit -m "Update locales" - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app_id: ${{ vars.PR_APP_ID }} - private_key: ${{ secrets.PR_CLIENT_SECRET }} - repositories: ${{ env.fork_owner }}/${{ env.repository }} + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # app_id: ${{ vars.PR_APP_ID }} + # private_key: ${{ secrets.PR_CLIENT_SECRET }} + # repositories: ${{ env.fork_owner }}/${{ env.repository }} # - uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} @@ -146,8 +146,8 @@ jobs: run: | # Force push to create the branch echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales || \ - git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + # || git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales env: PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} - name: Create PR From 292faf90fb5fe71bd6971b88ce17fc8e1438934a Mon Sep 17 00:00:00 2001 From: snomiao Date: Mon, 30 Dec 2024 21:15:46 +0000 Subject: [PATCH 19/25] fix(fix_custom_translations): use app token use app token --- .github/workflows/i18n-custom-nodes-test.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 26557af11..c9f1eab65 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -132,12 +132,12 @@ jobs: # Stage and commit changes git add -A git commit -m "Update locales" - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # app_id: ${{ vars.PR_APP_ID }} - # private_key: ${{ secrets.PR_CLIENT_SECRET }} - # repositories: ${{ env.fork_owner }}/${{ env.repository }} + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app_id: ${{ vars.PR_APP_ID }} + private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} + repositories: ${{ env.fork_owner }}/${{ env.repository }} # - uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} @@ -146,8 +146,8 @@ jobs: run: | # Force push to create the branch echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - # || git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + # git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales env: PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} - name: Create PR From 650675e6c1d52c6b7d63ab28fee770a76e036d78 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 31 Dec 2024 04:40:55 +0000 Subject: [PATCH 20/25] fix(fix_custom_translations): push by sshkey push by sshkey --- .github/workflows/i18n-custom-nodes-test.yaml | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index c9f1eab65..a7f8267f8 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -141,19 +141,30 @@ jobs: # - uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} + # - name: Push changes + # working-directory: ComfyUI/custom_nodes/${{ env.repository }} + # run: | + # # Force push to create the branch + # echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" + # # git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + # git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + # env: + # PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + # PR private key from action server + key: ${{ secrets.PR_SSH_PRIVATE_KEY }} + # github public key to confirm it's github server + known_hosts: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== - name: Push changes working-directory: ComfyUI/custom_nodes/${{ env.repository }} run: | # Force push to create the branch echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - # git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - env: - PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} + git push -f git@github.com:${{ env.fork_owner }}/${{ env.repository }}.git update-locales - name: Create PR working-directory: ComfyUI/custom_nodes/${{ env.repository }} run: | # Create PR using gh cli - gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales - env: - GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} \ No newline at end of file + gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales \ No newline at end of file From ea0a1fabf3b6ffd403ab3646f4df9c0071ff4391 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 31 Dec 2024 04:47:34 +0000 Subject: [PATCH 21/25] fix(workflows): skip app token skip app token --- .github/workflows/i18n-custom-nodes-test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index a7f8267f8..196901f34 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -132,12 +132,12 @@ jobs: # Stage and commit changes git add -A git commit -m "Update locales" - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app_id: ${{ vars.PR_APP_ID }} - private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} - repositories: ${{ env.fork_owner }}/${{ env.repository }} + # - uses: actions/create-github-app-token@v1 + # id: app-token + # with: + # app_id: ${{ vars.PR_APP_ID }} + # private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} + # repositories: ${{ env.fork_owner }}/${{ env.repository }} # - uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} From 1ff5adf86faf345782f8dfc88872d41b0fa95560 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 31 Dec 2024 04:50:39 +0000 Subject: [PATCH 22/25] fix(fix_custom_translations): try fork_owner try fork_owner --- .github/workflows/i18n-custom-nodes-test.yaml | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml index 196901f34..2069f5fff 100644 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ b/.github/workflows/i18n-custom-nodes-test.yaml @@ -132,12 +132,13 @@ jobs: # Stage and commit changes git add -A git commit -m "Update locales" - # - uses: actions/create-github-app-token@v1 - # id: app-token - # with: - # app_id: ${{ vars.PR_APP_ID }} - # private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} - # repositories: ${{ env.fork_owner }}/${{ env.repository }} + - uses: actions/create-github-app-token@v1 + id: app-token + with: + app_id: ${{ vars.PR_APP_ID }} + private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} + owner: ${{ env.fork_owner }} + repositories: ${{ env.repository }} # - uses: actions/checkout@v4 # with: # token: ${{ steps.app-token.outputs.token }} @@ -150,19 +151,23 @@ jobs: # git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales # env: # PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} - - name: Install SSH key - uses: shimataro/ssh-key-action@v2 - with: - # PR private key from action server - key: ${{ secrets.PR_SSH_PRIVATE_KEY }} - # github public key to confirm it's github server - known_hosts: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== - name: Push changes working-directory: ComfyUI/custom_nodes/${{ env.repository }} - run: | - # Force push to create the branch - echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - git push -f git@github.com:${{ env.fork_owner }}/${{ env.repository }}.git update-locales + run: git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales + + # - name: Install SSH key + # uses: shimataro/ssh-key-action@v2 + # with: + # # PR private key from action server + # key: ${{ secrets.PR_SSH_PRIVATE_KEY }} + # # github public key to confirm it's github server + # known_hosts: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== + # - name: Push changes + # working-directory: ComfyUI/custom_nodes/${{ env.repository }} + # run: | + # # Force push to create the branch + # echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" + # git push -f git@github.com:${{ env.fork_owner }}/${{ env.repository }}.git update-locales - name: Create PR working-directory: ComfyUI/custom_nodes/${{ env.repository }} run: | From 76e463d4ae9b7867fc167019368987ef7a2e8200 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 31 Dec 2024 05:00:18 +0000 Subject: [PATCH 23/25] fix(fix_custom_translations): remove test workflow remove test workflow --- .github/workflows/i18n-custom-nodes-test.yaml | 175 ------------------ .github/workflows/i18n-custom-nodes.yaml | 28 ++- 2 files changed, 20 insertions(+), 183 deletions(-) delete mode 100644 .github/workflows/i18n-custom-nodes-test.yaml diff --git a/.github/workflows/i18n-custom-nodes-test.yaml b/.github/workflows/i18n-custom-nodes-test.yaml deleted file mode 100644 index 2069f5fff..000000000 --- a/.github/workflows/i18n-custom-nodes-test.yaml +++ /dev/null @@ -1,175 +0,0 @@ -name: Update Locales for given custom node repository - -on: - push: - -env: - owner: huchenlei - repository: ComfyUI-IC-Light-Native - fork_owner: comfy-pr-bot - -jobs: - update-locales: - runs-on: ubuntu-latest - permissions: - contents: write # To push a branch - pull-requests: write # To create a PR from that branch - # - [git - Permission denied to github-actions[bot] despite having PAT - Stack Overflow]( https://stackoverflow.com/questions/74740868/permission-denied-to-github-actionsbot-despite-having-pat ) - steps: - - name: Checkout ComfyUI - uses: actions/checkout@v4 - with: - repository: 'comfyanonymous/ComfyUI' - path: 'ComfyUI' - ref: master - - name: Checkout ComfyUI_frontend - uses: actions/checkout@v4 - with: - repository: 'Comfy-Org/ComfyUI_frontend' - path: 'ComfyUI_frontend' - - name: Checkout ComfyUI_devtools - uses: actions/checkout@v4 - with: - repository: 'Comfy-Org/ComfyUI_devtools' - path: 'ComfyUI/custom_nodes/ComfyUI_devtools' - - name: Checkout custom node repository - uses: actions/checkout@v4 - with: - repository: ${{ env.owner }}/${{ env.repository }} - path: 'ComfyUI/custom_nodes/${{ env.repository }}' - - uses: actions/setup-node@v3 - with: - node-version: lts/* - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Install ComfyUI requirements - run: | - python -m pip install --upgrade pip - pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu - pip install -r requirements.txt - pip install wait-for-it - shell: bash - working-directory: ComfyUI - - name: Install custom node requirements - run: | - if [ -f "requirements.txt" ]; then - pip install -r requirements.txt - fi - shell: bash - working-directory: ComfyUI/custom_nodes/${{ env.repository }} - - name: Build & Install ComfyUI_frontend - run: | - npm ci - npm run build - rm -rf ../ComfyUI/web/* - mv dist/* ../ComfyUI/web/ - shell: bash - working-directory: ComfyUI_frontend - - name: Start ComfyUI server - run: | - python main.py --cpu --multi-user & - wait-for-it --service 127.0.0.1:8188 -t 600 - working-directory: ComfyUI - shell: bash - - name: Install Playwright Browsers - run: npx playwright install chromium --with-deps - working-directory: ComfyUI_frontend - - name: Start dev server - # Run electron dev server as it is a superset of the web dev server - # We do want electron specific UIs to be translated. - run: npm run dev:electron & - working-directory: ComfyUI_frontend - - name: Capture base i18n - run: npx tsx scripts/diff-i18n capture - working-directory: ComfyUI_frontend - - name: Update en.json - run: npm run collect-i18n - env: - PLAYWRIGHT_TEST_URL: http://localhost:5173 - working-directory: ComfyUI_frontend - - name: Update translations - run: npm run locale - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - working-directory: ComfyUI_frontend - - name: Diff base vs updated i18n - run: npx tsx scripts/diff-i18n diff - working-directory: ComfyUI_frontend - - name: Update i18n in custom node repository - run: | - LOCALE_DIR=ComfyUI/custom_nodes/${{ env.repository }}/locales/ - install -d "$LOCALE_DIR" - cp -rf ComfyUI_frontend/temp/diff/* "$LOCALE_DIR" - - name: Check and create fork of custom node repository - run: | - # Try to fork the repository - gh repo fork ${{ env.owner }}/${{ env.repository }} --clone=false || { - echo "Fork failed - repository might already be forked" - # Exit 0 to prevent the workflow from failing - exit 0 - } - - # Enable workflows on the forked repository - gh api \ - --method PUT \ - -H "Accept: application/vnd.github+json" \ - "/repos/${{ env.fork_owner }}/${{ env.repository }}/actions/permissions/workflow" \ - -F can_approve_pull_request_reviews=true \ - -F default_workflow_permissions="write" \ - -F enabled=true - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Commit changes - working-directory: ComfyUI/custom_nodes/${{ env.repository }} - run: | - git config --global user.name 'github-actions' - git config --global user.email 'github-actions@github.com' - - # Create and switch to new branch - git checkout -b update-locales - - # Stage and commit changes - git add -A - git commit -m "Update locales" - - uses: actions/create-github-app-token@v1 - id: app-token - with: - app_id: ${{ vars.PR_APP_ID }} - private_key: ${{ secrets.PR_APP_PRIVATE_KEY }} - owner: ${{ env.fork_owner }} - repositories: ${{ env.repository }} - # - uses: actions/checkout@v4 - # with: - # token: ${{ steps.app-token.outputs.token }} - # - name: Push changes - # working-directory: ComfyUI/custom_nodes/${{ env.repository }} - # run: | - # # Force push to create the branch - # echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - # # git push -f https://x-access-token:$PR_GH_TOKEN@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - # git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - # env: - # PR_GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} - - name: Push changes - working-directory: ComfyUI/custom_nodes/${{ env.repository }} - run: git push -f https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ env.fork_owner }}/${{ env.repository }}.git update-locales - - # - name: Install SSH key - # uses: shimataro/ssh-key-action@v2 - # with: - # # PR private key from action server - # key: ${{ secrets.PR_SSH_PRIVATE_KEY }} - # # github public key to confirm it's github server - # known_hosts: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== - # - name: Push changes - # working-directory: ComfyUI/custom_nodes/${{ env.repository }} - # run: | - # # Force push to create the branch - # echo "Pushing changes to ${{ env.fork_owner }}/${{ env.repository }}" - # git push -f git@github.com:${{ env.fork_owner }}/${{ env.repository }}.git update-locales - - name: Create PR - working-directory: ComfyUI/custom_nodes/${{ env.repository }} - run: | - # Create PR using gh cli - gh pr create --title "Update locales for ${{ env.repository }}" --repo ${{ env.owner }}/${{ env.repository }} --head ${{ env.fork_owner }}:update-locales \ No newline at end of file diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index 709d88b0e..b7188dac0 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -123,15 +123,14 @@ jobs: -F default_workflow_permissions="write" \ -F enabled=true env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - - name: Commit and push changes + GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} + + - name: Commit changes + working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - # Configure the remote with token - git remote set-url origin "https://x-access-token:$GH_TOKEN_PR@github.com/${{ inputs.fork_owner }}/${{ inputs.repository }}.git" - # Create and switch to new branch git checkout -b update-locales @@ -139,12 +138,25 @@ jobs: git add -A git commit -m "Update locales" + - name: Install SSH key For PUSH + uses: shimataro/ssh-key-action@v2 + with: + # PR private key from action server + key: ${{ secrets.PR_SSH_PRIVATE_KEY }} + # github public key to confirm it's github server + known_hosts: github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ== + + - name: Push changes + working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + run: | # Force push to create the branch echo "Pushing changes to ${{ inputs.fork_owner }}/${{ inputs.repository }}" - git push -f origin update-locales + git push -f git@github.com:${{ inputs.fork_owner }}/${{ inputs.repository }}.git update-locales + - name: Create PR + working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} + run: | # Create PR using gh cli gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales - working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} env: - GH_TOKEN_PR: ${{ secrets.GH_TOKEN_PR }} + GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} From e5b58a5806fb43f973e25d89e86503173753b007 Mon Sep 17 00:00:00 2001 From: snomiao Date: Tue, 31 Dec 2024 05:06:46 +0000 Subject: [PATCH 24/25] fix(workflows): add body draft add body draft --- .github/workflows/i18n-custom-nodes.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-custom-nodes.yaml b/.github/workflows/i18n-custom-nodes.yaml index b7188dac0..b8f60d45e 100644 --- a/.github/workflows/i18n-custom-nodes.yaml +++ b/.github/workflows/i18n-custom-nodes.yaml @@ -157,6 +157,6 @@ jobs: working-directory: ComfyUI/custom_nodes/${{ inputs.repository }} run: | # Create PR using gh cli - gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales + gh pr create --title "Update locales for ${{ inputs.repository }}" --repo ${{ inputs.owner }}/${{ inputs.repository }} --head ${{ inputs.fork_owner }}:update-locales --body "Update locales for ${{ inputs.repository }}" env: GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} From a2c0a7db3f4a27812ce45391f0c81b1d7e332c3e Mon Sep 17 00:00:00 2001 From: huchenlei Date: Tue, 31 Dec 2024 16:02:29 -0500 Subject: [PATCH 25/25] nit --- tmp | 1 - 1 file changed, 1 deletion(-) delete mode 160000 tmp diff --git a/tmp b/tmp deleted file mode 160000 index cdc61bc84..000000000 --- a/tmp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cdc61bc84445a5c48144e33907eabf96bdf2dd52