Sign inSign up

shyim/danger-php

By shyim

•Updated 3 days ago

Image
0

2.6K

shyim/danger-php repository overview

⁠Danger PHP

Danger runs during your CI process, and gives teams the chance to automate common code review chores. This project ports Danger⁠ to PHP.

Currently only GitHub and Gitlab are supported as Platform

⁠Badges

MIT License codecov

⁠Installation

⁠Composer

Install danger-php using Composer

composer global require shyim/danger-php
⁠Phar Archive

Every release has a phar archive attached

⁠Docker

Use the prebuilt Docker image⁠

⁠Documentation

⁠Disallow multiple commits with same message
<?php declare(strict_types=1);

use Danger\Config;
use Danger\Rule\DisallowRepeatedCommits;

return (new Config())
    ->useRule(new DisallowRepeatedCommits) // Disallows multiple commits with the same message
;
⁠Only allow one commit in Pull Request
<?php declare(strict_types=1);

use Danger\Config;
use Danger\Rule\MaxCommit;

return (new Config())
    ->useRule(new MaxCommit(1))
;


⁠Check for modification on CHANGELOG.md
<?php declare(strict_types=1);

use Danger\Config;
use Danger\Context;

return (new Config())
    ->useRule(function (Context $context): void {
        if (!$context->platform->pullRequest->getFiles()->has('CHANGELOG.md')) {
            $context->failure('Please edit also the CHANGELOG.md');
        }
    })
;

⁠Check for Assignee in PR
<?php declare(strict_types=1);

use Danger\Config;
use Danger\Context;

return (new Config())
    ->useRule(function (Context $context): void {
        if (count($context->platform->pullRequest->assignees) === 0) {
            $context->warning('This PR currently doesn\'t have an assignee');
        }
    })
;

⁠Screenshots

Example Comment

⁠License

MIT⁠

Tag summary

Content type

Image

Digest

sha256:80ff72dc9…

Size

43 MB

Last updated

3 days ago

docker pull shyim/danger-php