From 3bfd0d1caf53d0cd4cfca4c9f38b07c12e8a39a4 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Wed, 14 Oct 2026 22:20:06 +0300 Subject: [PATCH] ci: recheck PR title on edited via a title-only workflow (WealthLedger/frontend#64) --- .gitea/workflows/pr-title.yml | 34 ++++++++++++++++++++++++++++++++++ .gitea/workflows/verify.yml | 11 +++++------ README.md | 4 ++-- 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 .gitea/workflows/pr-title.yml diff --git a/.gitea/workflows/pr-title.yml b/.gitea/workflows/pr-title.yml new file mode 100644 index 0000000..950222e --- /dev/null +++ b/.gitea/workflows/pr-title.yml @@ -0,0 +1,34 @@ +name: Frontend verify + +# Metadata-only: refreshes only the `commits` context after a PR title edit. +# Same workflow name keeps the required context; `security` and `verify` +# statuses of the head revision stay untouched (no skipped overwrite). +on: + pull_request: + types: [edited] + +concurrency: + group: frontend-pr-title-${{ gitea.event.pull_request.number }} + cancel-in-progress: true + +jobs: + commits: + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - uses: https://github.com/actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - uses: https://github.com/actions/setup-node@v4 + with: + node-version-file: .nvmrc + - run: npm ci --ignore-scripts + - name: Check PR title and commits + env: + PR_TITLE: ${{ github.event.pull_request.title }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + printf '%s\n' "$PR_TITLE" | npm run commitlint -- --strict + npm run commitlint -- --strict --from "$BASE_SHA" --to "$HEAD_SHA" diff --git a/.gitea/workflows/verify.yml b/.gitea/workflows/verify.yml index 334b735..cd42d19 100644 --- a/.gitea/workflows/verify.yml +++ b/.gitea/workflows/verify.yml @@ -4,14 +4,13 @@ on: push: branches: [develop, main] pull_request: - types: [opened, synchronize, reopened, edited] + types: [opened, synchronize, reopened] schedule: - cron: '17 5 * * *' -# Gitea >= 1.26. A new revision supersedes only the same PR/branch/event; -# metadata-only `edited` runs use their own group so they never cancel a full run. +# Gitea >= 1.26. A new revision supersedes only the same PR/branch/event. concurrency: - group: frontend-verify-${{ gitea.event_name }}-${{ gitea.event.action == 'edited' && 'meta-' || '' }}${{ gitea.event.pull_request.number || gitea.ref }} + group: frontend-verify-${{ gitea.event_name }}-${{ gitea.event.pull_request.number || gitea.ref }} cancel-in-progress: true jobs: @@ -40,7 +39,7 @@ jobs: security: needs: commits if: >- - !cancelled() && gitea.event.action != 'edited' && + !cancelled() && (needs.commits.result == 'success' || needs.commits.result == 'skipped') timeout-minutes: 15 runs-on: ubuntu-latest @@ -69,7 +68,7 @@ jobs: needs: [commits, security] if: >- !cancelled() && needs.security.result == 'success' && - gitea.event_name != 'schedule' && gitea.event.action != 'edited' + gitea.event_name != 'schedule' timeout-minutes: 45 runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 46035e9..6ddefbf 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,8 @@ Chromium при ширинах 375 и 1280 px. Browser project не исполь Единый `.gitea/workflows/verify.yml` запускает `commits → security → verify` последовательно на PR; на push в `develop`/`main` — `security → verify`. Рабочие ветки проверяются после открытия PR, без дублирующего push-запуска. -Изменение заголовка PR (`edited`) запускает только `commits`; `security` и `verify` -пропускаются и не отменяют полный запуск того же PR (отдельная concurrency-группа). +Изменение заголовка PR запускает `.gitea/workflows/pr-title.yml` (то же имя workflow, +только job `commits`): статусы `security` и `verify` на HEAD не перезаписываются. Новый запуск отменяет устаревший для того же PR/ветки и типа события (требуется Gitea 1.26+). Ежедневно в 05:17 UTC выполняется только `security`. Job `security` проверяет полную доступную историю Gitleaks 8.30.1 и выполняет