auto-assign-reviewer-by-files icon indicating copy to clipboard operation
auto-assign-reviewer-by-files copied to clipboard

Error is thrown: Cannot read properties of undefined (reading 'number')

Open katyaaronov opened this issue 10 months ago • 2 comments

Hello,

The workflow seems to work well on feature branches, however it fails when a feature branch is merged (pushed) to the master branch with the following error: Cannot read properties of undefined (reading 'number')

assign_reviewer.yml:

name: Assign BDD reviewer

on:
  pull_request:
    types: [opened, synchronize, edited]
    branches:
      - master
      - v*.*
  push:
    branches:
      - master
      - v*.*

jobs:
  assign_reviewer:
    runs-on: ubuntu-22.04
    steps:
      - name: Assign BDD reviewer
        uses: shufo/[email protected]
        with:
          config: ".github/assign_by_path.yml"
          token: ${{ secrets.GH_ACCESS_TOKEN }}

assign_by_path.yml:

---
  "tests/e2e/**":
    - katyaaronov
  ".github/assign-by-path.yml":
    - katyaaronov
  ".github/labeler.yml":
    - katyaaronov
  ".github/workflows/assign_bdd_reviewer.yml":
    - katyaaronov
  ".github/workflows/bdd_assertthat_sync_from_github.yml":
    - katyaaronov
  ".github/workflows/bdd_get_tags.yml":
    - katyaaronov
  ".github/workflows/bdd_run_full_cycle*.yml":
    - katyaaronov
  ".github/workflows/bdd_run_label.yml":
    - katyaaronov
  ".github/workflows/bdd_run_ticket.yml":
    - katyaaronov
  ".github/workflows/bdd_validate.yml":
    - katyaaronov
  ".github/workflows/check-changes.yml":
    - katyaaronov

Thank you!

P.S. Is there a way to somehow pass all globs as an array instead of repeating the same reviewer for each?

katyaaronov avatar Jan 15 '25 15:01 katyaaronov

Thanks for creating the issue.

I think the error cause is this action intended to use for feature branch not for default branch.

  push:
    branches:
      - master

Currently pass all globs as an array is not supported but you can use glob for file names

".github/workflows/*.yml":
  - ~~~

shufo avatar Jan 21 '25 04:01 shufo

Thanks for creating the issue.

I think the error cause is this action intended to use for feature branch not for default branch.

push: branches: - master Currently pass all globs as an array is not supported but you can use glob for file names

".github/workflows/*.yml":

  1. I removed the 'push on master branch' trigger since no there is no pull_request at this stage. The 'pull_request' trigger is the only one that is needed and it works just fine. Thank you!

  2. I don't think I can use glob for "*.yml" because there are many .yml files changes in most of which should not trigger the labeler.

katyaaronov avatar Jan 26 '25 11:01 katyaaronov