labeler icon indicating copy to clipboard operation
labeler copied to clipboard

Could not get pull request number from context, exiting

Open PuneetKohli opened this issue 5 years ago • 2 comments

Similar to #25 I am getting the error "Could not get pull request number from context, exiting"

I tried playing around with a variety of things but could not get it to run.

.github/labeler.yml:

  # Add 'github' label to any change within the '.github' folder
github:
  - .github/*
  - .github/**/*

test:
  - lib/tests/*
  - lib/tests/**/*
  - multiview/src/test/*
  - multiview/src/test/*

.github/workflows/push.yml

on: push
name: On Push Workflow
jobs:
  triage:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/labeler@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

Also tried with a repo specific token. v2.1.0, and combining with another workflow - no results.

PuneetKohli avatar Oct 30 '19 07:10 PuneetKohli

I'm having the same issue here.

.github/labeler.yml

'Status: Review Needed':
  - docs/**/*

'Type: Content':
  - docs/**/*.md

'Type: Design':
  - docs/**/*.styl

'Type: Documentation':
  - README.md

'Type: Tooling':
  - .github/**/*

'Type: Dependencies':
  - package.json

'Type: Translation':
  - docs/translations/**/*
  - docs/.vuepress/theme/utils/translations.js

.github/workflows/labeler.yml

name: Labeler
on:
  schedule:
    - cron: '0 * * * *'

jobs:
  label:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/labeler@v2
        with:
          repo-token: '${{ secrets.GITHUB_TOKEN }}'

It looks to be coming from this line: https://github.com/actions/labeler/blob/4b52aec09ba832eb9aecccddbccce644ba9ba69d/src/main.ts#L20

In my case, I suspect the cronjob approach is causing the failure, because the action does not have the github.context.payload.pull_request needed in getPrNumber().

samajammin avatar Jun 05 '20 19:06 samajammin

I believe this error is related to run the pipeline on a branch and not PR: https://github.com/actions/labeler/blob/4b52aec09ba832eb9aecccddbccce644ba9ba69d/src/main.ts#L50

I got the same error. To fix I added to trigger this info: on: pull_request: types: [ opened, synchronize, reopened ]

marciomaciel avatar Jan 14 '21 16:01 marciomaciel

Hello everyone! This issue has been open for a year without any activity, so I'm going to close it as stale. Please feel free to contact us if the issue is still relevant to you and we will reopen it. Thanks!

MaksimZhukov avatar Dec 12 '22 06:12 MaksimZhukov