From 6f643e6b02341b48c30d917efdf282797ba6a5e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 10:12:24 +0000 Subject: [PATCH 01/10] Initial plan From 6e800e626454329d81fae3ac0bd83f5b46bb401f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 10:14:57 +0000 Subject: [PATCH 02/10] Optimize workflows to avoid duplicate runs on PR commits Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++++ .github/workflows/lint.yml | 4 ++++ .github/workflows/pypi-publish.yml | 8 +++++++- .github/workflows/unittest.yml | 4 ++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 71db85b70..931ddd70a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,6 +35,10 @@ on: jobs: analyze: name: Analyze + # Skip if this is a push event triggered by a pull request + # (to avoid running the workflow twice for PR commits) + # Run on pull_request events OR push events that are NOT from a PR + if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7d88abf11..f2673f9f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,6 +26,10 @@ on: jobs: ruff: + # Skip if this is a push event triggered by a pull request + # (to avoid running the workflow twice for PR commits) + # Run on pull_request events OR push events that are NOT from a PR + if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index f3158dec1..43c3e3cde 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -18,6 +18,10 @@ on: jobs: echo_github_env: name: Echo env variables + # Skip if this is a push event triggered by a pull request + # (to avoid running the workflow twice for PR commits) + # Run on pull_request events OR push events that are NOT from a PR + if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest steps: - run: | @@ -32,7 +36,9 @@ jobs: name: Check build trigger runs-on: ubuntu-latest # Not for forks - if: github.repository == 'pythainlp/pythainlp' + # Skip if this is a push event triggered by a pull request + # (to avoid running the workflow twice for PR commits) + if: github.repository == 'pythainlp/pythainlp' && (github.event_name == 'pull_request' || github.event.pull_request == null) outputs: build: ${{ steps.check_build_trigger.outputs.build }} steps: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 7e2a85328..72fa87755 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -29,6 +29,10 @@ on: jobs: unittest: + # Skip if this is a push event triggered by a pull request + # (to avoid running the workflow twice for PR commits) + # Run on pull_request events OR push events that are NOT from a PR + if: github.event_name == 'pull_request' || github.event.pull_request == null strategy: fail-fast: false matrix: From 686c3180e7a1a0a1c5caf46477cc1c4c37ea9abf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 10:15:54 +0000 Subject: [PATCH 03/10] Improve comment clarity in pypi-publish.yml Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/pypi-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 43c3e3cde..b6931fc97 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -35,9 +35,9 @@ jobs: check_build_trigger: name: Check build trigger runs-on: ubuntu-latest - # Not for forks - # Skip if this is a push event triggered by a pull request - # (to avoid running the workflow twice for PR commits) + # Only run if: + # 1. Not a fork (repository must be 'pythainlp/pythainlp') + # 2. AND not a duplicate (skip push events triggered by pull requests) if: github.repository == 'pythainlp/pythainlp' && (github.event_name == 'pull_request' || github.event.pull_request == null) outputs: build: ${{ steps.check_build_trigger.outputs.build }} From 4f49e932ea4db0fe719d660a680087b65e563868 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Sun, 1 Feb 2026 10:51:46 +0000 Subject: [PATCH 04/10] Update CHANGELOG.md to push something and test the unittest condition --- CHANGELOG.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 458b31c50..58c1bb324 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,15 +15,25 @@ Notable changes between versions. ## Version 5.2.0 -> dev +Minimum required version is now 3.9. +Support for Python 3.7 and 3.8 has been removed. +Added official support and CI testing for Python 3.14. + Some features and fixes in this version are AI-assisted. See PR for prompt and details. +- Fix `royin` romanization #1172 +- Fix final consonant classification in `check_marttra()` #1173 - Lazy load dictionaries to reduce memory usage #1186 -- Fix KeyError when transliterating text with Thai alphabet Kho Khon (U+0E05) #1187 -- Consolidate configuration into pyproject.toml #1188 -- Update type hints; Use Python 3.9 features #1189 #1190 -- Replace requests library with urllib.request from standard library to reduce - core dependencies #1211 +- Fix Kho Khon alphabet issue in `tltk` transliteration #1187 +- Migrate configurations to pyproject.toml #1188 #1226 #1239 +- Update type hints; Use Python 3.9 features #1189 #1190 & etc. +- Remove duplicated entries in volubilis dictionary #1200 +- Remove star imports #1207 +- Remove `requests` dependency #1211 +- Make package zip-safe #1212 +- Ensure thread-safety for tokenizers #1213 +- Improved documentation; code cleanup; more tests ## Version 5.1.2 -> 5.2.0 From 2bf30ddeb111fe3d025555cecab17b30ae990443 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 11:08:26 +0000 Subject: [PATCH 05/10] Fix workflow deduplication using concurrency groups Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 12 ++++++++---- .github/workflows/lint.yml | 12 ++++++++---- .github/workflows/pypi-publish.yml | 18 ++++++++++-------- .github/workflows/unittest.yml | 12 ++++++++---- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 931ddd70a..931c6bbdf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,13 +32,17 @@ on: schedule: - cron: '17 9 * * 5' +# Avoid duplicate runs for pull_request events. +# For pull requests to dev, the workflow runs on both push and pull_request events, +# but we only want it to run once. The concurrency group is the same for both, +# so the push event will be cancelled when the pull_request event starts. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: analyze: name: Analyze - # Skip if this is a push event triggered by a pull request - # (to avoid running the workflow twice for PR commits) - # Run on pull_request events OR push events that are NOT from a PR - if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f2673f9f7..0c8de2e87 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,12 +24,16 @@ on: - '**.yml' - 'docs/**' +# Avoid duplicate runs for pull_request events. +# For pull requests to dev, the workflow runs on both push and pull_request events, +# but we only want it to run once. The concurrency group is the same for both, +# so the push event will be cancelled when the pull_request event starts. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: ruff: - # Skip if this is a push event triggered by a pull request - # (to avoid running the workflow twice for PR commits) - # Run on pull_request events OR push events that are NOT from a PR - if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index b6931fc97..8441278a9 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,13 +15,17 @@ on: types: [published] # "Publish release" button workflow_dispatch: # Manual trigger to test wheel build +# Avoid duplicate runs for pull_request events. +# For pull requests to dev, the workflow runs on both push and pull_request events, +# but we only want it to run once. The concurrency group is the same for both, +# so the push event will be cancelled when the pull_request event starts. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: echo_github_env: name: Echo env variables - # Skip if this is a push event triggered by a pull request - # (to avoid running the workflow twice for PR commits) - # Run on pull_request events OR push events that are NOT from a PR - if: github.event_name == 'pull_request' || github.event.pull_request == null runs-on: ubuntu-latest steps: - run: | @@ -35,10 +39,8 @@ jobs: check_build_trigger: name: Check build trigger runs-on: ubuntu-latest - # Only run if: - # 1. Not a fork (repository must be 'pythainlp/pythainlp') - # 2. AND not a duplicate (skip push events triggered by pull requests) - if: github.repository == 'pythainlp/pythainlp' && (github.event_name == 'pull_request' || github.event.pull_request == null) + # Not for forks + if: github.repository == 'pythainlp/pythainlp' outputs: build: ${{ steps.check_build_trigger.outputs.build }} steps: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 72fa87755..ce3818768 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -27,12 +27,16 @@ on: - "MANIFEST.in" - "pyproject.toml" +# Avoid duplicate runs for pull_request events. +# For pull requests, the workflow runs on both push and pull_request events, +# but we only want it to run once. The concurrency group is the same for both, +# so the push event will be cancelled when the pull_request event starts. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: unittest: - # Skip if this is a push event triggered by a pull request - # (to avoid running the workflow twice for PR commits) - # Run on pull_request events OR push events that are NOT from a PR - if: github.event_name == 'pull_request' || github.event.pull_request == null strategy: fail-fast: false matrix: From 66dcb1dd2b84fa2f107c33f2cb1f0ad077a110f0 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Sun, 1 Feb 2026 11:52:33 +0000 Subject: [PATCH 06/10] Update distributed_pyspark.py Test push something to test new CI --- examples/distributed_pyspark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/distributed_pyspark.py b/examples/distributed_pyspark.py index c078d9ab0..b070a5bfa 100644 --- a/examples/distributed_pyspark.py +++ b/examples/distributed_pyspark.py @@ -11,7 +11,7 @@ PyThaiNLP's core tokenization engines are thread-safe, making them suitable for distributed computing environments where multiple threads may process data concurrently. For detailed information about thread safety, see: -https://github.com/PyThaiNLP/pythainlp/blob/dev/docs/threadsafe.rst +https://pythainlp.org/dev-docs/notes/threadsafe.html For information about data directory configuration in distributed environments, see: https://github.com/PyThaiNLP/pythainlp/issues/475 From 5770622b9982c79a9c58880f0f95808eec2c553d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:05:45 +0000 Subject: [PATCH 07/10] Simplify concurrency groups and remove unrelated CHANGELOG changes Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 8 +++----- .github/workflows/lint.yml | 8 +++----- .github/workflows/pypi-publish.yml | 9 ++++----- .github/workflows/unittest.yml | 8 +++----- CHANGELOG.md | 20 +++++--------------- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 931c6bbdf..d7d3355e0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,12 +32,10 @@ on: schedule: - cron: '17 9 * * 5' -# Avoid duplicate runs for pull_request events. -# For pull requests to dev, the workflow runs on both push and pull_request events, -# but we only want it to run once. The concurrency group is the same for both, -# so the push event will be cancelled when the pull_request event starts. +# Avoid duplicate runs for the same workflow and Git ref. +# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0c8de2e87..07fabb070 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,12 +24,10 @@ on: - '**.yml' - 'docs/**' -# Avoid duplicate runs for pull_request events. -# For pull requests to dev, the workflow runs on both push and pull_request events, -# but we only want it to run once. The concurrency group is the same for both, -# so the push event will be cancelled when the pull_request event starts. +# Avoid duplicate runs for the same workflow and Git ref. +# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 8441278a9..ef8719839 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,12 +15,11 @@ on: types: [published] # "Publish release" button workflow_dispatch: # Manual trigger to test wheel build -# Avoid duplicate runs for pull_request events. -# For pull requests to dev, the workflow runs on both push and pull_request events, -# but we only want it to run once. The concurrency group is the same for both, -# so the push event will be cancelled when the pull_request event starts. +# Avoid duplicate runs for the same workflow and Git ref. +# This applies to all triggers (push, pull_request, release, workflow_dispatch). +# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index ce3818768..c9dcf42d8 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -27,12 +27,10 @@ on: - "MANIFEST.in" - "pyproject.toml" -# Avoid duplicate runs for pull_request events. -# For pull requests, the workflow runs on both push and pull_request events, -# but we only want it to run once. The concurrency group is the same for both, -# so the push event will be cancelled when the pull_request event starts. +# Avoid duplicate runs for the same workflow and Git ref. +# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/CHANGELOG.md b/CHANGELOG.md index 58c1bb324..458b31c50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,25 +15,15 @@ Notable changes between versions. ## Version 5.2.0 -> dev -Minimum required version is now 3.9. -Support for Python 3.7 and 3.8 has been removed. -Added official support and CI testing for Python 3.14. - Some features and fixes in this version are AI-assisted. See PR for prompt and details. -- Fix `royin` romanization #1172 -- Fix final consonant classification in `check_marttra()` #1173 - Lazy load dictionaries to reduce memory usage #1186 -- Fix Kho Khon alphabet issue in `tltk` transliteration #1187 -- Migrate configurations to pyproject.toml #1188 #1226 #1239 -- Update type hints; Use Python 3.9 features #1189 #1190 & etc. -- Remove duplicated entries in volubilis dictionary #1200 -- Remove star imports #1207 -- Remove `requests` dependency #1211 -- Make package zip-safe #1212 -- Ensure thread-safety for tokenizers #1213 -- Improved documentation; code cleanup; more tests +- Fix KeyError when transliterating text with Thai alphabet Kho Khon (U+0E05) #1187 +- Consolidate configuration into pyproject.toml #1188 +- Update type hints; Use Python 3.9 features #1189 #1190 +- Replace requests library with urllib.request from standard library to reduce + core dependencies #1211 ## Version 5.1.2 -> 5.2.0 From a57ebec36cefa4fcc10d1450b76d43ab7c750bd8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:10:02 +0000 Subject: [PATCH 08/10] Fix concurrency groups to properly deduplicate push and PR runs Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 8 +++++--- .github/workflows/lint.yml | 8 +++++--- .github/workflows/pypi-publish.yml | 10 ++++++---- .github/workflows/unittest.yml | 8 +++++--- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d7d3355e0..937b9ed86 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,10 +32,12 @@ on: schedule: - cron: '17 9 * * 5' -# Avoid duplicate runs for the same workflow and Git ref. -# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. +# Avoid duplicate runs for the same source branch. +# For push events, uses the branch name from github.ref_name. +# For pull_request events, uses the source branch name from github.head_ref. +# This ensures push and pull_request events for the same branch share the same group. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 07fabb070..0d724eed5 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,10 +24,12 @@ on: - '**.yml' - 'docs/**' -# Avoid duplicate runs for the same workflow and Git ref. -# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. +# Avoid duplicate runs for the same source branch. +# For push events, uses the branch name from github.ref_name. +# For pull_request events, uses the source branch name from github.head_ref. +# This ensures push and pull_request events for the same branch share the same group. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index ef8719839..aad7c51f9 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,11 +15,13 @@ on: types: [published] # "Publish release" button workflow_dispatch: # Manual trigger to test wheel build -# Avoid duplicate runs for the same workflow and Git ref. -# This applies to all triggers (push, pull_request, release, workflow_dispatch). -# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. +# Avoid duplicate runs for the same source branch. +# For push events, uses the branch name from github.ref_name. +# For pull_request events, uses the source branch name from github.head_ref. +# This ensures push and pull_request events for the same branch share the same group. +# Also applies to release (uses tag name) and workflow_dispatch (uses branch/tag name). concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index c9dcf42d8..fbbfc1a01 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -27,10 +27,12 @@ on: - "MANIFEST.in" - "pyproject.toml" -# Avoid duplicate runs for the same workflow and Git ref. -# With cancel-in-progress: true, a new run for the same ref cancels any in-progress run. +# Avoid duplicate runs for the same source branch. +# For push events, uses the branch name from github.ref_name. +# For pull_request events, uses the source branch name from github.head_ref. +# This ensures push and pull_request events for the same branch share the same group. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: From 7e2697f956d1b52f1a4e901fde0d81d60f65e227 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 13:04:37 +0000 Subject: [PATCH 09/10] Add repository qualifier to concurrency groups to avoid cross-fork collisions Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 12 +++++++++--- .github/workflows/lint.yml | 12 +++++++++--- .github/workflows/pypi-publish.yml | 12 +++++++++--- .github/workflows/unittest.yml | 12 +++++++++--- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 937b9ed86..e75654ab6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,12 +32,18 @@ on: schedule: - cron: '17 9 * * 5' -# Avoid duplicate runs for the same source branch. +# Avoid duplicate runs for the same source branch and repository. +# For pull_request events, uses the source repo name from +# github.event.pull_request.head.repo.full_name; otherwise uses github.repository. # For push events, uses the branch name from github.ref_name. # For pull_request events, uses the source branch name from github.head_ref. -# This ensures push and pull_request events for the same branch share the same group. +# This ensures events for the same repo and branch share the same group, +# and avoids cross-fork collisions when branch names are reused. concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: >- + ${{ github.workflow }}-${{ + github.event.pull_request.head.repo.full_name || github.repository + }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0d724eed5..383158175 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,12 +24,18 @@ on: - '**.yml' - 'docs/**' -# Avoid duplicate runs for the same source branch. +# Avoid duplicate runs for the same source branch and repository. +# For pull_request events, uses the source repo name from +# github.event.pull_request.head.repo.full_name; otherwise uses github.repository. # For push events, uses the branch name from github.ref_name. # For pull_request events, uses the source branch name from github.head_ref. -# This ensures push and pull_request events for the same branch share the same group. +# This ensures events for the same repo and branch share the same group, +# and avoids cross-fork collisions when branch names are reused. concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: >- + ${{ github.workflow }}-${{ + github.event.pull_request.head.repo.full_name || github.repository + }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index aad7c51f9..de1461fe4 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,13 +15,19 @@ on: types: [published] # "Publish release" button workflow_dispatch: # Manual trigger to test wheel build -# Avoid duplicate runs for the same source branch. +# Avoid duplicate runs for the same source branch and repository. +# For pull_request events, uses the source repo name from +# github.event.pull_request.head.repo.full_name; otherwise uses github.repository. # For push events, uses the branch name from github.ref_name. # For pull_request events, uses the source branch name from github.head_ref. -# This ensures push and pull_request events for the same branch share the same group. +# This ensures events for the same repo and branch share the same group, +# and avoids cross-fork collisions when branch names are reused. # Also applies to release (uses tag name) and workflow_dispatch (uses branch/tag name). concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: >- + ${{ github.workflow }}-${{ + github.event.pull_request.head.repo.full_name || github.repository + }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index fbbfc1a01..b1b9f3ad5 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -27,12 +27,18 @@ on: - "MANIFEST.in" - "pyproject.toml" -# Avoid duplicate runs for the same source branch. +# Avoid duplicate runs for the same source branch and repository. +# For pull_request events, uses the source repo name from +# github.event.pull_request.head.repo.full_name; otherwise uses github.repository. # For push events, uses the branch name from github.ref_name. # For pull_request events, uses the source branch name from github.head_ref. -# This ensures push and pull_request events for the same branch share the same group. +# This ensures events for the same repo and branch share the same group, +# and avoids cross-fork collisions when branch names are reused. concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + group: >- + ${{ github.workflow }}-${{ + github.event.pull_request.head.repo.full_name || github.repository + }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: From 3cd14c522011e1c5427accfb36cbe6eb73136820 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 14:36:53 +0000 Subject: [PATCH 10/10] Protect scheduled CodeQL scans from cancellation and remove unrelated test file Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 3 ++- examples/distributed_pyspark.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e75654ab6..c613ade92 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,12 +39,13 @@ on: # For pull_request events, uses the source branch name from github.head_ref. # This ensures events for the same repo and branch share the same group, # and avoids cross-fork collisions when branch names are reused. +# Schedule events are not cancelled to ensure weekly scans complete. concurrency: group: >- ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name != 'schedule' }} jobs: analyze: diff --git a/examples/distributed_pyspark.py b/examples/distributed_pyspark.py index b070a5bfa..c078d9ab0 100644 --- a/examples/distributed_pyspark.py +++ b/examples/distributed_pyspark.py @@ -11,7 +11,7 @@ PyThaiNLP's core tokenization engines are thread-safe, making them suitable for distributed computing environments where multiple threads may process data concurrently. For detailed information about thread safety, see: -https://pythainlp.org/dev-docs/notes/threadsafe.html +https://github.com/PyThaiNLP/pythainlp/blob/dev/docs/threadsafe.rst For information about data directory configuration in distributed environments, see: https://github.com/PyThaiNLP/pythainlp/issues/475