Skip to content

GeorgeSapkin/hyperstickler

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyperStickler

test status

Commit & PR formalities checker based on the OpenWrt submission guidelines.

Rules

  • Pull request must come from a feature branch
  • Pull request must not include merge commits
  • Author name must be either a real name 'firstname lastname' or a nickname/alias/handle
  • Author email must not be a GitHub noreply email
  • Commit(ter) name must be either a real name 'firstname lastname' or a nickname/alias/handle
  • Commit(ter) email must not be a GitHub noreply email
  • Commit subject must not start with whitespace
  • Commit subject must start with <package name or prefix>:
  • Commit subject must start with a lower-case word after the prefix
  • Commit subject must not end with a period
  • Commit subject must be <= MAX_SUBJECT_LEN_HARD (and should be <= MAX_SUBJECT_LEN_SOFT) characters long. Limits are 60 and 50 by default, respectively and are configurable via the max_subject_len_hard and max_subject_len_soft inputs.
  • Signed-off-by must match author. Enabled via the check_signoff input.
  • Signed-off-by must not be a GitHub noreply email. Enabled via the check_signoff input.
  • Commit message must exist
  • Commit message lines should be <= MAX_BODY_LINE_LEN characters long. Limit is 75 by default and is configurable via the max_body_line_len input.
  • Commit to stable branch should be marked as cherry-picked

Inputs

All inputs are optional.

check_signoff

  • Check if Signed-off-by exists and matches author.
  • Default: false.

exclude_dependabot

  • Exclude commits authored by dependabot from some checks.
  • Default: true.

exclude_weblate

  • Exclude commits authored by Weblate from some checks.
  • Default: false.

feedback_url

  • URL to provide feedback to. If empty, no feedback text will be added to either console log or comment.
  • Default: HyperStickler repository.

guideline_url

job_step

  • Job step number that full log link in comment should point to. Otherwise it will point to the job itself. Requires post_comment to be true.

max_body_line_len

  • Max body line length. Longer lines result in a warning.
  • Default: 75.

max_subject_len_hard

  • Hard max subject line length limit. Longer subjects fails check.
  • Default: 60.

max_subject_len_soft

  • Soft max subject line length limit. Longer subjects result in a warning.
  • Default: 50.

post_comment

  • Post summaries to the pull request.
  • Default: false.

warn_on_no_modify

  • Warn when PR edits by maintainers are not allowed. Requires post_comment to be true.
  • Default: false.

Permissions

Posting comments requires pull-requests: write.

Example usage

name: Formalities
on:
  pull_request_target:

permissions:
  pull-requests: write

jobs:
  formal:
    runs-on: ubuntu-slim
    name: Formalities
    steps:
      - name: Check formalities
        uses: georgesapkin/hyperstickler@main
        with:
          check_signoff: true
          exclude_weblate: true
          post_comment: true

Example output

Example output

Example status comment

Warning

Some formality checks failed.

Consider (re)reading submissions guidelines.

Failed checks

Issues marked with an ❌ are failing checks.

Commit 57b3864

  • ❌ Commit subject must start with <package name or prefix>:

  • Signed-off-by must match author

    Actual: missing or doesn't match author

    Expected: Signed-off-by: Hosted Weblate <[email protected]>

Commit 5058449

  • 🔶 Commit message lines should be <= 75 characters long

    Actual: line 1 is 137 characters long

    $\textsf{This line in the commit body is extremely long and should definitely exceed\color{red}{ the seventy-five character limit imposed by the check script.}}$

Commit 2e99bff

  • 🔶 Commit subject must be <= 60 (and should be <= 50) characters long

    Actual: subject is 58 characters long

    $\textsf{package: this subject is long and should trigger a\color{yellow}{ warning}\color{red}{}}$

Commit fed351d

  • 🔶 Author name must be either a real name 'firstname lastname' or a nickname/alias/handle

    Actual: Nickname seems to be a nickname or an alias

    Expected: a real name 'firstname lastname'

Commit 5130080

  • ❌ Commit message must exist

Commit d13201a

  • Signed-off-by must match author

    Actual: missing or doesn't match author

    Expected: Signed-off-by: Good Author <[email protected]>

Commit 5f4c710

  • Signed-off-by must match author

    Actual: missing or doesn't match author

    Expected: Signed-off-by: Good Author <[email protected]>

Commit b26caff

  • ❌ Commit subject must be <= 60 (and should be <= 50) characters long

    Actual: subject is 86 characters long

    $\textsf{package: this subject is way too long and should f\color{yellow}{ail the ha}\color{red}{rd limit check of 60 chars}}$

Commit d6ffd3d

  • ❌ Commit subject must not end with a period

Commit bb7a6f8

  • ❌ Commit subject must start with a lower-case word after the prefix

Commit 0f2c7e8

  • ❌ Commit subject must start with <package name or prefix>:

Commit f7d3b13

  • ❌ Commit subject must not start with whitespace
  • ❌ Commit subject must start with <package name or prefix>:

Commit ff3950e

  • ❌ Author email must not be a GitHub noreply email

    Expected: a real email address

  • Signed-off-by must not be a GitHub noreply email

    Expected: a real email address

For more details, see the full job log.

Something broken? Consider providing feedback.

Tests

Tests use /tmp to create a temporary git repository in. Otherwise an alternative test path can be passed to the test script that will be created before running tests and removed afterwards.

src/test.sh /optional/path/to/test/repo

License

GNU General Public License v2.0 only