From 5606383b19ce23b489b40de3771308ca030f5393 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 1 Jul 2026 20:26:49 +0200 Subject: [PATCH] github: add webhook formality check Replace the external formality check GitHub Action with a lightweight webhook managed by the openwrt-bot-worker engine. Using a webhook instead of a heavy GitHub Action workflow is much more suitable for quick formality checks. GitHub Actions are constrained by concurrency limits across repositories, often causing long delays. In contrast, the webhook validates commits near-instantly. The validation rules are configured via `.github/formalities.json`. Since verifying `PKG_VERSION`, `PKG_RELEASE`, and mandatory release notes are not relevant for the LuCI repository (unlike packages), these checks are disabled. Additionally, the formality check is now a hard requirement. The build workflow will only run once the formality check passes, saving runner resources. Signed-off-by: Josef Schlehofer --- .github/formalities.json | 26 ++++++++++++++++++++++++++ .github/workflows/build.yml | 17 +++++++++++++++++ .github/workflows/formal.yml | 29 ----------------------------- 3 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 .github/formalities.json delete mode 100644 .github/workflows/formal.yml diff --git a/.github/formalities.json b/.github/formalities.json new file mode 100644 index 0000000000..2a78049b7b --- /dev/null +++ b/.github/formalities.json @@ -0,0 +1,26 @@ +{ + "check_branch": true, + "check_merge_commits": true, + "check_noreply_email": true, + "check_signoff": true, + "check_signature": true, + "allow_autosquash": true, + "enable_comments": true, + "max_subject_len_soft": 60, + "max_subject_len_hard": 80, + "max_body_line_len": 100, + "warn_duplicate_body": true, + "warn_generic_subjects": true, + "require_release_notes": false, + "require_body": true, + "check_pkg_version": false, + "check_crlf": true, + "add_package_label": true, + "drop_package_label": true, + "branch_labeling": true, + "check_openwrt_meta": ["PKG_MAINTAINER", "PKG_LICENSE"], + "check_conffiles": true, + "check_patch_headers": true, + "check_pkg_release": "disabled", + "require_linked_github_account": true +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0135467d33..012ac807fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,25 @@ name: Test Build on: pull_request: +permissions: + contents: read + checks: read + jobs: + wait-for-formalities: + name: Wait for FormalityCheck + runs-on: ubuntu-slim + steps: + - name: Wait for Check Run + uses: lewagon/wait-on-check-action@v1.8.0 + with: + ref: ${{ github.event.pull_request.head.sha }} + check-name: 'FormalityCheck / Git & Commits' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 5 + build: + needs: wait-for-formalities uses: openwrt/actions-shared-workflows/.github/workflows/multi-arch-test-build.yml@main with: matrix: '{"include": [{"arch": "x86_64", "target": "x86-64"}]}' diff --git a/.github/workflows/formal.yml b/.github/workflows/formal.yml deleted file mode 100644 index d0fd3fc4ee..0000000000 --- a/.github/workflows/formal.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Test Formalities - -on: - pull_request_target: - -permissions: - contents: read - pull-requests: write - -jobs: - formalities: - name: Test Formalities - runs-on: ubuntu-slim - - steps: - - name: Run HyperStickler - uses: georgesapkin/hyperstickler@v1 - with: - check_branch: true - check_signoff: true - exclude_weblate: true - feedback_url: 'https://github.com/openwrt/actions-shared-workflows/issues' - guideline_url: 'https://openwrt.org/submitting-patches#submission_guidelines' - job_step: 2 - max_subject_len_soft: 78 - max_subject_len_hard: 80 - max_body_line_len: 80 - post_comment: true - warn_on_no_modify: true