bpmn-io / actions

The custom github actions used by the bpmn-io team
Other
0 stars 5 forks source link

TypeError: Cannot read properties of null (reading 'login') #27

Open aabouzaid opened 1 month ago

aabouzaid commented 1 month ago

Describe the Bug

When the action runs it shows this error:

Run bpmn-io/actions/weekly-notes@latest
  with:
    template-path: .github/ISSUE_TEMPLATE/WEEKLY_NOTE.md
    moderators-path: .github/workflows/moderators.json
    roles: moderator,summary-writer
    week-interval: 2
    token: ***
    community-worker: true
[weekly-notes] computing next issue title { currentWeek: { weekNumber: 27, year: 2024 }, weekInterval: 2 }
/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:29256
  const lastIndex = findIndex(candidates, c => c.login === lastAssignee.login);
                                                                        ^

TypeError: Cannot read properties of null (reading 'login')
    at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:29256:73
    at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31378:9
    at forEach (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31440:16)
    at findIndex (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:31377:3)
    at getNextAssignee (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:29256:21)
    at /home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:32262:10
    at Array.map (<anonymous>)
    at run (/home/runner/work/_actions/bpmn-io/actions/latest/weekly-notes/index.js:32259:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.13.1

You can see it live here: https://github.com/camunda/distribution/actions/runs/9809118739/job/27086303179#step:2:12

Steps to Reproduce

Current workflow:

name: Weekly
on:
  issues:
    types: [closed]
jobs:
  createWeeklyIssue:
    runs-on: ubuntu-latest
    permissions:
      issues: write
      contents: read
    steps:
      - if: contains(github.event.issue.labels.*.name, 'weekly')
        name: Create new Issue
        uses: bpmn-io/actions/weekly-notes@latest
        with:
          template-path: ".github/ISSUE_TEMPLATE/WEEKLY_NOTE.md"
          moderators-path: ".github/workflows/moderators.json"
          roles: moderator,summary-writer
          week-interval: 2

Expected Behavior

The action should run and create the weekly issue.

Environment

barmac commented 1 month ago

Thanks for reporting! Perhaps this can be fixed easily via a default value. Would you like to contribute a fix?

barmac commented 1 month ago

BTW this issue can only be reproduced when there's no assignee to the weekly issue. Quite an edge case, given that the action automatically assigns people.

nikku commented 1 week ago

Tagging as good first issue + spring cleaning.