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

Release Drafter crashes with "Cannot read property 'login' of null in releases.js" when a pull request submitter is deleted #301

Closed
oleg-nenashev opened this issue Sep 6, 2019 · 9 comments · Fixed by #313

Comments

@oleg-nenashev
Copy link
Contributor

Hi all! We use the GitHub app to run Release Drafter in the Jenkins project. We use a centralized configuration which runs across 80 repositories ATM. Currently it works for the most of the repositories really well, except the diagnosability issues (I'd guess migration to GitHub Actions or self-hosting would be a right step for our project scale).

Yesterday we hit an issue with https://github.com/jenkinsci/gradle-plugin . The release drafter was enabled there yesterday, and the App was enabled for the repo. Everything looks fine AFAICT, but the changes are not being generated.

It would be great if somebody could take a look at the application logs so that we kno the root cause of the issue

CC @wolfs

@rihardsgrislis
Copy link

We also experience issues with draft being created. We merged several PRs in master branch, but the draft wasn't created.

@oleg-nenashev
Copy link
Contributor Author

@rihardssceredins could you please add links to your configurations? The issues might be unrelated

@rihardsgrislis
Copy link

rihardsgrislis commented Sep 10, 2019

Our repos ar private so I'm going to post it here. We use the same configuration across all repos. In some repos it works perfect, in some it doesn't or is seriously delayed. I mean after PR is merged the draft may appear between a minute and several hours.

name-template: 'v$NEXT_PATCH_VERSION'
tag-template: 'v$NEXT_PATCH_VERSION'
categories:
  - title: '🚀 Features'
    labels:
      - 'feature'
      - 'enhancement'
  - title: '🐛 Bug Fixes'
    labels:
      - 'fix'
      - 'bugfix'
      - 'bug'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
  ## Changes

  $CHANGES

@oleg-nenashev
Copy link
Contributor Author

After running the Release Drafter using GitHub Actions in one of the affected repos we see that:

08:55:09.968Z ERROR event: Cannot read property 'login' of null (id=960355aa-000c-40cc-8022-c170ce26de0f)
  TypeError: Cannot read property 'login' of null
      at acc.push.categorizedPullRequests.(anonymous function).map.pullRequest (/app/lib/releases.js:153:43)
      at Array.map (<anonymous>)
      at orderedCategories.reduce (/app/lib/releases.js:149:12)
      at Array.reduce (<anonymous>)
      at generateChangeLog (/app/lib/releases.js:136:6)
      at module.exports.generateReleaseInfo (/app/lib/releases.js:179:17)
      at app.on (/app/index.js:69:25)
  --
  event: {
    "event": "push",
    "id": "960355aa-000c-40cc-8022-c170ce26de0f",
    "repository": "jenkinsci/gradle-plugin"
  }

Code: https://github.com/toolmantim/release-drafter/blob/v5.2.0/lib/releases.js#L153 , looks like PR author is null due to whatever reason. Maybe a deleted GitHub account?

If so, it might be a regression after #164 in 5.0.0. CC @TimonVS

@oleg-nenashev oleg-nenashev changed the title Release Drafter app does not work for one repo TypeError: Cannot read property 'login' of null in releases.js Sep 17, 2019
@rihardsgrislis
Copy link

rihardsgrislis commented Sep 17, 2019 via email

@rihardsgrislis
Copy link

This is the output from GitHub Actions when an app has no releases and you run release-drafter. I've redacted the repo name in the output.

2019-09-13T13:47:59.7322134Z ##[group]Run toolmantim/release-drafter@v5.2.0
2019-09-13T13:47:59.7400690Z env:
2019-09-13T13:47:59.7401226Z   GITHUB_TOKEN: ***
2019-09-13T13:47:59.7401366Z ##[endgroup]
2019-09-13T13:47:59.7759734Z ##[command]/usr/bin/docker run --name df7dc3b0d3721859e41eea1a5c7972ec92e4a_a6e960 --label 0df7dc --workdir /github/workspace --rm -e GITHUB_TOKEN -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/***/***":"/github/workspace" 0df7dc:3b0d3721859e41eea1a5c7972ec92e4a
2019-09-13T13:48:01.4825178Z 13:48:01.477Z  INFO probot: creativegs/***: Found 0 releases
2019-09-13T13:48:01.4826208Z 13:48:01.479Z  INFO probot: creativegs/***: No draft release found
2019-09-13T13:48:01.4826586Z 13:48:01.479Z  INFO probot: creativegs/***: No last release found
2019-09-13T13:48:01.4826970Z 13:48:01.479Z  INFO probot: creativegs/***: Fetching all commits for branch master
2019-09-13T13:49:55.2448956Z 13:49:55.243Z ERROR event: Cannot read property 'login' of null (id=a0828448-2b0b-4038-9c95-2316263227a4)
2019-09-13T13:49:55.2449675Z   TypeError: Cannot read property 'login' of null
2019-09-13T13:49:55.2449854Z       at acc.push.categorizedPullRequests.(anonymous function).map.pullRequest (/app/lib/releases.js:153:43)
2019-09-13T13:49:55.2450010Z       at Array.map (<anonymous>)
2019-09-13T13:49:55.2450146Z       at orderedCategories.reduce (/app/lib/releases.js:149:12)
2019-09-13T13:49:55.2450281Z       at Array.reduce (<anonymous>)
2019-09-13T13:49:55.2450411Z       at generateChangeLog (/app/lib/releases.js:136:6)
2019-09-13T13:49:55.2452217Z       at module.exports.generateReleaseInfo (/app/lib/releases.js:179:17)
2019-09-13T13:49:55.2452374Z       at app.on (/app/index.js:69:25)
2019-09-13T13:49:55.2452752Z   --
2019-09-13T13:49:55.2452882Z   event: {
2019-09-13T13:49:55.2452951Z     "event": "push",
2019-09-13T13:49:55.2453258Z     "id": "a0828448-2b0b-4038-9c95-2316263227a4",
2019-09-13T13:49:55.2453562Z     "repository": "creativegs/***"
2019-09-13T13:49:55.2453685Z   }
2019-09-13T13:49:55.6875205Z ##[error]Docker run failed with exit code 1

oleg-nenashev added a commit to oleg-nenashev/jenkins-release-drafter that referenced this issue Oct 9, 2019
oleg-nenashev added a commit to oleg-nenashev/jenkins-release-drafter that referenced this issue Oct 9, 2019
Fix release-drafter#301 - Prevent crash when a pull request author is unknown
oleg-nenashev added a commit to jenkinsci/gradle-plugin that referenced this issue Oct 9, 2019
@oleg-nenashev oleg-nenashev changed the title TypeError: Cannot read property 'login' of null in releases.js Release Drafter crashes with "Cannot read property 'login' of null in releases.js" when a pull request submitter is deleted Oct 9, 2019
@oleg-nenashev
Copy link
Contributor Author

I confirm that deleted users were a root cause for us:

@toolmantim @Casz @timja @wolfs ready for review

@TimonVS
Copy link
Member

TimonVS commented Dec 4, 2019

Fix has been released in v5.3.1

@oleg-nenashev
Copy link
Contributor Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants