squalrus / merge-bot

A GitHub action that manages pull request integrations
MIT License
70 stars 12 forks source link

Error: Cannot read properties of undefined (reading 'labels') #77

Open chickenandpork opened 1 year ago

chickenandpork commented 1 year ago

Describe the bug In a single-author repo using merge-bot to merge because I'm too lazy/forgetful to go back and check, I'm getting the error message at subject: Error: Cannot read properties of undefined (reading 'labels')

I've successfully used merge-bot for organizations, but in this case, it's just me, forgetful me, copying a functional config and I can't see how to debug this. FWIW, I can see the value of labels in the JSON dump.

To Reproduce Steps to reproduce the behavior:

.github/workflows/build-and-merge.yml:

on:
  pull_request:
    types:
      - opened
      - reopened
  push:

jobs:
  build:
    ...
  merge:
    runs-on: ubuntu-latest
    permissions:
      # checked with all "write"
    steps:
      - name: Merge Workflow for tagged PRs
        uses: squalrus/merge-bot@v0.4.5
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          blocking_labels: do not merge, invalid
          checks_enabled: true
          # settings, "Pull Requests" section, "[x] Automatically delete head branches"
          delete_source_branch: false
          labels: automerge
          method: squash
          # reviewers: true  -- don't actually want my own review, just a tag
          reviewers: false
          test: true
  1. push a PR, label it "automerge"
  2. watch the action fail with Error: Cannot read properties of undefined (reading 'labels')

Expected behavior A tagged PR that builds should merge

Desktop (please complete the following information):

Additional context

$ gh pr view 19 --json labels
{
  "labels": [
    {
      "id": "LA_kwDOKFf69c8AAAABXivleg",
      "name": "automerge",
      "description": "",
      "color": "42EA5A"
    }
  ]
}