Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] MergeHandler fails when commit is not linked to user account #90

Closed
sstok opened this issue Dec 20, 2020 · 1 comment · Fixed by #91
Closed

[bug] MergeHandler fails when commit is not linked to user account #90

sstok opened this issue Dec 20, 2020 · 1 comment · Fixed by #91
Assignees
Labels

Comments

@sstok
Copy link
Member

sstok commented Dec 20, 2020

HubKit version(s) affected: 1.0

Description
This pull request failed to merge because the commit was using the GitHub web interface, and no user was selected.
rollerworks/PasswordStrengthValidator#39

Possible Solution

        foreach ($commits as $commit) {
            if (! isset($commit['author'])) {
                $authors['web-flow'] = $authors['commit']['author']['name'] ?? 'web-flow'; // web-flow is the default user for GitHub web edited commits.
            } else {
                $authors[$commit['author']['login']] = $commit['author']['login'];
            }

            $message .= $commit['sha'].' '.explode("\n", $commit['commit']['message'], 2)[0]."\n";
        }

Additional context

Print-r dump of the commit.

Array
(
    [sha] => 0a4acd92e95a6d5df7f08a955af3aee10b03f02b
    [node_id] => MDY6Q29tbWl0MzIyNTU4MDI3OjBhNGFjZDkyZTk1YTZkNWRmN2YwOGE5NTVhZjNhZWUxMGIwM2YwMmI=
    [commit] => Array
        (
            [author] => Array
                (
                    [name] => Cédric Martineau
                    [email] => c.martineau@soqrate.com
                    [date] => 2020-12-18T11:04:46Z
                )

            [committer] => Array
                (
                    [name] => Cédric Martineau
                    [email] => c.martineau@soqrate.com
                    [date] => 2020-12-18T11:04:46Z
                )

            [message] => Fix regex for specials characters
            [tree] => Array
                (
                    [sha] => 27221ca879d57cc0e6353b9f827e6f5276c4feab
                    [url] => https://api.github.com/repos/tino299/PasswordStrengthValidator/git/trees/27221ca879d57cc0e6353b9f827e6f5276c4feab
                )

            [url] => https://api.github.com/repos/tino299/PasswordStrengthValidator/git/commits/0a4acd92e95a6d5df7f08a955af3aee10b03f02b
            [comment_count] => 0
            [verification] => Array
                (
                    [verified] =>
                    [reason] => unsigned
                    [signature] =>
                    [payload] =>
                )

        )

    [url] => https://api.github.com/repos/tino299/PasswordStrengthValidator/commits/0a4acd92e95a6d5df7f08a955af3aee10b03f02b
    [html_url] => https://github.com/tino299/PasswordStrengthValidator/commit/0a4acd92e95a6d5df7f08a955af3aee10b03f02b
    [comments_url] => https://api.github.com/repos/tino299/PasswordStrengthValidator/commits/0a4acd92e95a6d5df7f08a955af3aee10b03f02b/comments
    [author] =>
    [committer] =>
    [parents] => Array
        (
            [0] => Array
                (
                    [sha] => 98a72a0a8a2f599afee137666ae0c4faceee25d3
                    [url] => https://api.github.com/repos/tino299/PasswordStrengthValidator/commits/98a72a0a8a2f599afee137666ae0c4faceee25d3
                    [html_url] => https://github.com/tino299/PasswordStrengthValidator/commit/98a72a0a8a2f599afee137666ae0c4faceee25d3
                )

        )

)

Note. I will try to fix this later today 👍🏼

@sstok sstok added the Bug label Dec 20, 2020
@sstok sstok self-assigned this Dec 20, 2020
@sstok
Copy link
Member Author

sstok commented Dec 20, 2020

Trouble waking-up 😬

We can simply use the pr author (not the commit author) if this information is missing 🤷🏼‍♂️
And actually better to fix this in the GitHub service directly in case this problem appears somewhere else.

@sstok sstok closed this as completed in #91 Dec 22, 2020
sstok added a commit that referenced this issue Dec 22, 2020
This PR was merged into the 1.0-dev branch.

Discussion
----------

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tickets       | Fix #90 
| License       | MIT



Commits
-------

2fec1bb Fix MergeHandler commit with no author info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant