From 213f98fbf3ce870de5fee03c4a28f665a6a95fbc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:07:27 +0000 Subject: [PATCH 1/5] Initial plan From 1ce873f7efda671fb4577d3826bea9420ea56369 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:11:03 +0000 Subject: [PATCH 2/5] Add cancellation handling to prevent red X on cancelled jobs Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 13 +++++++ .github/workflows/lint.yml | 13 +++++++ .github/workflows/pypi-publish.yml | 52 +++++++++++++++++++++++++++ .github/workflows/unittest.yml | 13 +++++++ 4 files changed, 91 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c613ade92..be30802e5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -92,3 +92,16 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 + + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 383158175..8b4c3d3b3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -49,3 +49,16 @@ jobs: with: src: "./pythainlp ./tests ./examples" args: check --verbose --config pyproject.toml + + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index de1461fe4..ae5a8281d 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -42,6 +42,19 @@ jobs: echo "github.ref_type : ${{ github.ref_type }}" echo "github.event.ref : ${{ github.event.ref }}" + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi + # Check whether to build the wheels and the source tarball check_build_trigger: name: Check build trigger @@ -60,6 +73,19 @@ jobs: run: bash build_tools/github/check_build_trigger.sh # To trigger the build steps, add "[cd build]" to commit message + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi + build: name: Build and check distributions needs: [check_build_trigger] @@ -93,6 +119,19 @@ jobs: with: path: dist + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi + publish_pypi: name: Publish to PyPI runs-on: ubuntu-latest @@ -111,3 +150,16 @@ jobs: skip-existing: true user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index b9d3c7b26..014c46437 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -153,3 +153,16 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PYTHONIOENCODING: utf-8 run: coveralls + + # Ensure cancelled jobs don't show as failed (red X) in PR checks + # This step always runs and treats cancellation as success + - name: Check job status + if: always() + run: | + if [ "${{ job.status }}" = "cancelled" ]; then + echo "Job was cancelled due to concurrency - treating as success" + exit 0 + elif [ "${{ job.status }}" = "failure" ]; then + echo "Job failed" + exit 1 + fi From 4f779d3a554bd99d16dfbdfde4aa227836f61ab8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:13:42 +0000 Subject: [PATCH 3/5] Handle all job statuses explicitly in cancellation check Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 5 ++++- .github/workflows/lint.yml | 5 ++++- .github/workflows/pypi-publish.yml | 20 ++++++++++++++++---- .github/workflows/unittest.yml | 5 ++++- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index be30802e5..634db70b9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -101,7 +101,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8b4c3d3b3..53018f302 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -58,7 +58,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index ae5a8281d..64b1fade2 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -50,7 +50,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi @@ -81,7 +84,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi @@ -127,7 +133,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi @@ -159,7 +168,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 014c46437..e0e208b19 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -162,7 +162,10 @@ jobs: if [ "${{ job.status }}" = "cancelled" ]; then echo "Job was cancelled due to concurrency - treating as success" exit 0 - elif [ "${{ job.status }}" = "failure" ]; then + elif [ "${{ job.status }}" = "success" ]; then + echo "Job succeeded" + exit 0 + else echo "Job failed" exit 1 fi From 1c9138d06ea2f463f2dfac0b6d03835bd43a4814 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:15:27 +0000 Subject: [PATCH 4/5] Use cancelled() function for proper cancellation handling Co-authored-by: bact <128572+bact@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 18 ++----- .github/workflows/lint.yml | 18 ++----- .github/workflows/pypi-publish.yml | 72 ++++++++------------------- .github/workflows/unittest.yml | 18 ++----- 4 files changed, 35 insertions(+), 91 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 634db70b9..032f19c94 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -94,17 +94,9 @@ jobs: uses: github/codeql-action/analyze@v4 # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 53018f302..8037dff5b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -51,17 +51,9 @@ jobs: args: check --verbose --config pyproject.toml # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 64b1fade2..66c762e38 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -43,20 +43,12 @@ jobs: echo "github.event.ref : ${{ github.event.ref }}" # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 # Check whether to build the wheels and the source tarball check_build_trigger: @@ -77,20 +69,12 @@ jobs: # To trigger the build steps, add "[cd build]" to commit message # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 build: name: Build and check distributions @@ -126,20 +110,12 @@ jobs: path: dist # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 publish_pypi: name: Publish to PyPI @@ -161,17 +137,9 @@ jobs: password: ${{ secrets.PYPI_API_TOKEN }} # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index e0e208b19..84d193a50 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -155,17 +155,9 @@ jobs: run: coveralls # Ensure cancelled jobs don't show as failed (red X) in PR checks - # This step always runs and treats cancellation as success - - name: Check job status - if: always() + # When job is cancelled by concurrency, this step ensures success status + - name: Ensure success on cancellation + if: always() && cancelled() run: | - if [ "${{ job.status }}" = "cancelled" ]; then - echo "Job was cancelled due to concurrency - treating as success" - exit 0 - elif [ "${{ job.status }}" = "success" ]; then - echo "Job succeeded" - exit 0 - else - echo "Job failed" - exit 1 - fi + echo "Job was cancelled - marking as success to avoid misleading red X" + exit 0 From 857e1f2c0909bd4a5091d4a74b8b69020d3df86c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Feb 2026 23:34:29 +0000 Subject: [PATCH 5/5] Revert cancellation handling - approach doesn't work 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 | 32 --------------------------- .github/workflows/unittest.yml | 8 ------- 4 files changed, 56 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 032f19c94..c613ade92 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -92,11 +92,3 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 - - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8037dff5b..383158175 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -49,11 +49,3 @@ jobs: with: src: "./pythainlp ./tests ./examples" args: check --verbose --config pyproject.toml - - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 66c762e38..de1461fe4 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -42,14 +42,6 @@ jobs: echo "github.ref_type : ${{ github.ref_type }}" echo "github.event.ref : ${{ github.event.ref }}" - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 - # Check whether to build the wheels and the source tarball check_build_trigger: name: Check build trigger @@ -68,14 +60,6 @@ jobs: run: bash build_tools/github/check_build_trigger.sh # To trigger the build steps, add "[cd build]" to commit message - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 - build: name: Build and check distributions needs: [check_build_trigger] @@ -109,14 +93,6 @@ jobs: with: path: dist - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 - publish_pypi: name: Publish to PyPI runs-on: ubuntu-latest @@ -135,11 +111,3 @@ jobs: skip-existing: true user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} - - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0 diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 84d193a50..b9d3c7b26 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -153,11 +153,3 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PYTHONIOENCODING: utf-8 run: coveralls - - # Ensure cancelled jobs don't show as failed (red X) in PR checks - # When job is cancelled by concurrency, this step ensures success status - - name: Ensure success on cancellation - if: always() && cancelled() - run: | - echo "Job was cancelled - marking as success to avoid misleading red X" - exit 0